core/timestamp.c File Reference


Detailed Description

Id
timestamp.c,v 1.30 2008/02/01 06:24:29 d3g637 Exp

Definition in file timestamp.c.

Go to the source code of this file.

Defines

#define _timezone   timezone
#define _tzname   tzname
#define DAY   (86400*TS_SECOND)
 the number of ticks in one day
#define DOW0   (4)
#define GMTIME(T)   ((T)+tzoffset-(isdst((T)+tzoffset)?3600:0))
#define HOUR   (3600*TS_SECOND)
 the number of ticks in one hour
#define ISLEAPYEAR(Y)   ((Y)%4==0 && ((Y)%100!=0 || (Y)%400==0))
#define LOCALTIME(T)   ((T)-tzoffset+(isdst((T))?3600:0))
#define MICROSECOND   (TS_SECOND/1000000)
 the number of ticks in one microsecond
#define MINUTE   (60*TS_SECOND)
 the number of ticks in one minute
#define SECOND   (TS_SECOND)
 the number of ticks in one second
#define TZFILE   "tzinfo.txt"
#define YEAR0   (1970)
#define YEAR0_ISLY   (0)

Functions

TIMESTAMP compute_dstevent (int year, SPEC *spec, time_t offset)
 Computes the GMT time of a DST event Offset indicates the time offset to include.
int convert_from_timestamp (TIMESTAMP ts, char *buffer, int size)
 Convert from a timestamp to a string.
TIMESTAMP convert_to_timestamp (char *value)
 Convert from a string to a timestamp.
int isdst (TIMESTAMP t)
 Determine whether a GMT timestamp is under DST rules.
void load_tzspecs (char *tz)
 Load a timezone from the timezone info file.
int local_datetime (TIMESTAMP ts, DATETIME *dt)
 Converts a GMT timestamp to local datetime struct Adjusts to TZ if possible.
TIMESTAMP mkdatetime (DATETIME *dt)
 Convert a datetime struct into a GMT timestamp.
void set_tzspec (int year, char *tzname, SPEC *pStart, SPEC *pEnd)
 Apply a timezone spec to the current tz rules.
int strdatetime (DATETIME *t, char *buffer, int size)
 Convert a datetime struct to a string.
char * timestamp_current_timezone (void)
 Read the current timezone specification.
char * timestamp_set_tz (char *tz_name)
 Establish the default timezone for time conversion.
int timestamp_test (void)
 Test the daylight saving time calculations.
double timestamp_to_days (TIMESTAMP t)
double timestamp_to_hours (TIMESTAMP t)
double timestamp_to_minutes (TIMESTAMP t)
double timestamp_to_seconds (TIMESTAMP t)
int timestamp_year (TIMESTAMP ts, TIMESTAMP *remainder)
 Determine the year of a GMT timestamp Apply remainder if given.
char * tz_dst (char *tzspec)
 Get the std timezone name.
int tz_info (char *tzspec, char *tzname, char *std, char *dst, time_t *offset)
 Extract information from an ISO timezone specification.
char * tz_name (char *tzspec)
 Converts a timezone spec into a standard timezone name Populate tzspec if provided, otherwise returns a static buffer.
time_t tz_offset (char *tzspec)
 Compute the offset of a tz spec.
char * tz_std (char *tzspec)
 Get the std timezone name.


GridLAB-DTM Version 1.0
An open-source project initiated by the US Department of Energy