DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T u

⟦019861142⟧ TextFile

    Length: 1530 (0x5fa)
    Types: TextFile
    Names: »utctime.c«

Derivation

└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0
    └─⟦dc59850a2⟧ »EurOpenD22/pp5.0/pp-5.tar.Z« 
        └─⟦e5a54fb17⟧ 
            └─⟦this⟧ »pp-5.0/Lib/util/utctime.c« 

TextFile

/* utctime: utctime functions */

# ifndef lint
static char Rcsid[] = "@(#)$Header: /cs/research/pp/hubris/pp-beta/Lib/util/RCS/utctime.c,v 5.0 90/09/20 16:18:16 pp Exp Locker: pp $";
# endif

/*
 * $Header: /cs/research/pp/hubris/pp-beta/Lib/util/RCS/utctime.c,v 5.0 90/09/20 16:18:16 pp Exp Locker: pp $
 *
 * $Log:	utctime.c,v $
 * Revision 5.0  90/09/20  16:18:16  pp
 * rcsforce : 5.0 public release
 * 
 */



#include "util.h"
#include <isode/psap.h>

UTC	time_t2utc ();
time_t	utc2time_t ();
UTC	utcdup ();
time_t	time ();

UTC	time_t2utc(t)
time_t	t;
{
	struct tm *tm;
	struct UTCtime uts;

	tm = gmtime (&t);
	tm2ut (tm, &uts);
	return utcdup(&uts);
}


UTC 	utclocalise(utc)
UTC	utc;
{
/*	static int	init = FALSE;
	static int	hours_west;*/
	time_t	ti;
	struct tm	*tm;
	struct UTCtime	uts;

/*	if (init == FALSE) {
		struct timeval dummy;
		struct timezone time_zone;

		gettimeofday (&dummy, &time_zone);
		hours_west = time_zone.tz_minuteswest/60;
		init = TRUE;
	}*/
	
	ti = utc2time_t(utc);
	tm = localtime(&ti);
	tm2ut (tm, &uts);
#ifdef sun
	if (tm -> tm_gmtoff != 0) {
		uts.ut_flags |= UT_ZONE;
		uts.ut_zone = tm -> tm_gmtoff / 60;
	}
#endif
/*	uts.ut_zone = hours_west;*/
	return utcdup(&uts);
}

UTC	utcdup (utc)
UTC	utc;
{
	UTC	ut;

	ut = (UTC) smalloc (sizeof *ut);
	*ut = *utc;
	return ut;
}

time_t utc2time_t(utc)
UTC	utc;
{
	struct tm *tm;
	if (utc == NULLUTC)
		return (time_t) 0;
	tm = ut2tm (utc);
	return gtime (tm);
}

UTC	utcnow ()
{
	time_t	now;

	(void) time (&now);
	return time_t2utc (now);
}