Go to the source code of this file.
Data Structures | |
struct | timezones |
Data structure that defines a time zone (for example "MET DST -3600"). More... | |
struct | tstamp_ref |
The data structure defines a couple (date, timestamp) used as reference. More... | |
struct | ttref_tab |
The data structure defines the list of couples (date, timestamp) loaded from the timestamps reference file). More... | |
struct | tz_tab |
Data structure that contains all the time zone configuration extracted from the time zones configuration file. This structure is set up by the function load_timezones() (calling the time zones configuration file parser). More... | |
Defines | |
#define | TZSET_MAX_SIZE 256 |
Maximum number of bytes for the environment variable "TZ" (ex: "TZ=GMT +0"). | |
#define | TIMEZONE_SIZE 50 |
Maximum number of bytes for the tag that defines the time zone (MET, CEST, ...). | |
#define | DAYLIGHT_SIZE 50 |
Maximum number of bytes for the tag that defines the time daylight saving mode (DST, ...). | |
#define | MAX_TSM_DATE_SIZE 256 |
This defines the maximum number of bytes for a TSM formated date (ex: Thu Aug 30 01:00:48 MET DST 2001). | |
#define | MAX_TZ_DEF 300 |
This defines the maximum number of lines in the time zones configuration file. One line is a set of 3 vales: (time zone, daylight saving mode, time shift) - for example (MET DST -3600). | |
#define | TIME_ZONES_DEF_OVERFLOW -1 |
Return value for the function load_timezones(). Too many time zones definitions in the time zones configuration file. This maximum number is represented by the constant MAX_TZ_DEF. | |
#define | TIME_ZONES_NO_MEM -2 |
Return value for the function load_timezones(). This means that the program is running out of memory. | |
#define | TIME_ZONES_TIMEZONE_OVERFLOW -3 |
Return value for the function load_timezones() (or via the time zone configuration parser). This means that the time zone configuration file is not valid. One time zone tag is too long (too many characters). | |
#define | TIME_ZONES_DAYLIGHT_OVERFLOW -4 |
Return value for the function load_timezones() (or via the time zone configuration parser). This means that the time zone configuration file is not valid. One daylight saving tag is too long. | |
#define | TIME_ZONES_PARSE_ERROR -5 |
Return value for the function load_timezones() (or via the time zone configuration parser). This means that the time zone configuration file is not valid. The parser found a syntax error. | |
#define | TIME_ZONES_NO_FILE -6 |
Return value for the function load_timezones(). No time zones configuration file specified. Please read the documentation for the function load_timezones(). | |
#define | TIME_ZONES_NO_DEF_FOUND -7 |
Return value for the function load_timezones(). This means that the time zones configuration file is empty (no configuration found). | |
#define | TIME_ZONES_CAN_NOT_OPEN_FILE -8 |
Return value for the function load_timezones(). Can not open the time zones configuration file. | |
#define | TIME_ZONES_LOAD_OK -9 |
Return value for the function load_timezones(). This means that the function loaded the time zones configuration file successfully. | |
#define | AUTOMATIC_TIME_SHIFT_COMPUTATION 86400 |
If the last argument of the function date2timestamp() is set to AUTOMATIC_TIME_SHIFT_COMPUTATION, then the function date2timestamp() will use the external timezone configuration file to find out the correct time shift. please note that AUTOMATIC_TIME_SHIFT_COMPUTATION = 24*3600 (one day shift). | |
#define | TTREF_MAX_DATE_SIZE 1020 |
Maximum size for a reference date (load the timestamps reference parser). | |
#define | TTREF_MAX_TIMESTAMP_SIZE 100 |
Maximum size for a reference timestamp (load the timestamps reference parser). | |
#define | MAX_TTREF_ENTRIES 300 |
Maximum number of entries in the reference timestamp configuration file. | |
#define | TTREF_TOO_MANY_REF -1 |
Return value for the timestamps reference parser. | |
#define | TTREF_NO_MEM -2 |
Return value for the timestamps reference parser. | |
#define | TTREF_SYNTAX_ERROR -3 |
Return value for the timestamps reference parser. | |
#define | TTREF_DATE_TOO_LONG -4 |
Return value for the timestamps reference parser. | |
#define | TTREF_REF_TOO_LONG -5 |
Return value for the timestamps reference parser. | |
#define | TTREF_CAN_NOT_OPEN_CONF_FILE -6 |
Return value for the function test_tz_conf(). This means that this function could not open the configuration file. | |
#define | TTREF_INVALID_DATE -7 |
Return value for the function test_tz_conf(). This means that one of the input date was invalid (the input date comes from the timestamps reference configuration file. | |
#define | TTREF_OK 0 |
Return value for the function test_tz_conf(). This means that the timestamps' computation was correct. | |
#define | TTREF_KO 1 |
Return value for the function test_tz_conf(). This means that the timestamps' computation was not correct. | |
#define | TZ_AUTOCONF_ON 0 |
Configuration value for the function test_tz_conf(). This means that we request the time zone auto configuration mode. | |
#define | TZ_AUTOCONF_OFF 1 |
Configuration value for the function test_tz_conf(). This means that we do NOT request the time zone auto configuration mode. | |
#define | DAY_OF_THE_WEEK 0 |
This defines fields' indexes. The day of the week is the field number 0 (the first one) in the TSM's date. | |
#define | MONTH 1 |
This defines fields' indexes. The month is the field numbre 1 (the second one) in the TSM's date. | |
#define | DAY_OF_THE_MONTH 2 |
This defines fields' indexes. The day of the month is the field number 2 (the third one) in the TSM's date. | |
#define | CLOCK 3 |
This defines fields' indexes. The clock time is the field number 3 (the fourth one) in the TSM's date. | |
#define | HOUR 0 |
This defines fields' indexes. The hour is the field number 0 (the first one) in the TSM's clock time. | |
#define | MINUTES 1 |
This defines fields' indexes. The minute is the field number 1 (the second one) in the TSM's clock time. | |
#define | SECONDS 2 |
This defines fields' indexes. The second is the field number 2 (the third one) in the TSM's clock time. | |
#define | TAG1 4 |
This defines fields' indexes. The tag "MET" should be the field number 4 (the fifth one) in the TSM's date. | |
#define | TAG2 5 |
This defines fields' indexes. The tag "DST" should be the field number 5 (the sixth one) in the TSM's date. | |
#define | YEAR 6 |
This defines fields' indexes. The year should be the field number 6 (the seventh one) in the TSM's date. | |
#define | MAX_TIMER_SIZE 256 |
The maximum number of bytes used to save the current date. | |
#define | DATE_HPP |
Functions | |
int | set_local_TZ_to_GMT () |
Set the local time zone to GTM (which is equivalent to UTC). | |
char * | print_tz_conf () |
Returns a zero terminated string of characters that represents the time zones configuration. | |
int | test_tz_conf (char *config_file, int auto_conf) |
Check the time zone configuration data against well known couple (date, timestamps). | |
int | load_timezones (char *filename) |
Load time zones definitions. | |
int | tzfound (struct timezones *tzz) |
Find a time zone data structure in the time zone configuration file. | |
int | tzcmp (struct timezones *tz1, struct timezones *tz2) |
Compare 2 timezone structures. | |
int | get_day (char *day) |
Returns the index of the day (starting at 0, so the returned value is between 0 and 6). The first day (index 0) is 'Sunday'. | |
int | get_month (char *month) |
Returns the index of the month (starting at 0, so the returned value is between 0 and 11). The first month (index 0) is 'january'. | |
char * | date2timestamp (char *date, char *timestamp, int nbcar, int shift) |
Calculate the timestamp of a ticket (The number of seconds since the first of January 1970). | |
char * | dater () |
Return the current date as Apache's standard. | |
time_t | get_utc_timestamp () |
Return the number of seconds since 00:00:00 UTC, January 1, 1970. | |
char * | get_tsm_date (time_t timestamp, int debug) |
Format a TSM date (ex: "Tue Sep 17 11:48:39 MET 2002") from a given timestamp. |
Definition in file date.h.
|
Calculate the timestamp of a ticket (The number of seconds since the first of January 1970).
Definition at line 262 of file date.c. References AUTOMATIC_TIME_SHIFT_COMPUTATION, CLOCK, current_tz, DAY_OF_THE_MONTH, DAY_OF_THE_WEEK, timezones::daylight, DAYLIGHT_SIZE, free_fields(), get_day(), get_month(), HOUR, MINUTES, MONTH, fields::number_of_fields, s_split(), SECONDS, timezones::shift, fields::tabs, TAG1, TAG2, timezones::timezone, TIMEZONE_SIZE, tzfound(), and YEAR. Referenced by test_tz_conf(). |
|
Return the current date as Apache's standard.
Definition at line 500 of file date.c. References MAX_TIMER_SIZE. |
|
Returns the index of the day (starting at 0, so the returned value is between 0 and 6). The first day (index 0) is 'Sunday'.
Definition at line 175 of file date.c. References days. Referenced by date2timestamp(). |
|
Returns the index of the month (starting at 0, so the returned value is between 0 and 11). The first month (index 0) is 'january'.
Definition at line 192 of file date.c. References months. Referenced by date2timestamp(). |
|
Format a TSM date (ex: "Tue Sep 17 11:48:39 MET 2002") from a given timestamp.
Definition at line 667 of file date.c. References current_tz, days, MAX_TSM_DATE_SIZE, months, tzname, and TZSET_MAX_SIZE. |
|
Return the number of seconds since 00:00:00 UTC, January 1, 1970.
|
|
Load time zones definitions.
Definition at line 84 of file date.c. References dateyyin, dateyylex(), tz_tab::entry_number, TIME_ZONES_CAN_NOT_OPEN_FILE, TIME_ZONES_LOAD_OK, TIME_ZONES_NO_DEF_FOUND, TIME_ZONES_NO_FILE, and tzs. |
|
Returns a zero terminated string of characters that represents the time zones configuration.
Definition at line 207 of file date.c. References DAYLIGHT_SIZE, tz_tab::entry_number, TIMEZONE_SIZE, TTREF_MAX_TIMESTAMP_SIZE, tz_tab::tz, and tzs. |
|
Set the local time zone to GTM (which is equivalent to UTC).
Definition at line 54 of file date.c. References current_tz, and TZSET_MAX_SIZE. |
|
Check the time zone configuration data against well known couple (date, timestamps).
Definition at line 556 of file date.c. References AUTOMATIC_TIME_SHIFT_COMPUTATION, current_tz, date2timestamp(), timezones::daylight, ttref_tab::entry_number, timezones::shift, string2time_t(), timezones::timezone, ttref_tab::ttref, TTREF_CAN_NOT_OPEN_CONF_FILE, TTREF_INVALID_DATE, TTREF_KO, TTREF_MAX_DATE_SIZE, TTREF_MAX_TIMESTAMP_SIZE, TTREF_OK, ttrefin, ttreflex(), ttrefs, and TZ_AUTOCONF_OFF. |
|
Compare 2 timezone structures.
Definition at line 120 of file date.c. References timezones::daylight, and timezones::timezone. Referenced by tzfound(). |
|
Find a time zone data structure in the time zone configuration file.
Definition at line 136 of file date.c. References current_tz, tz_tab::entry_number, timezones::shift, tz_tab::tz, tzcmp(), and tzs. Referenced by date2timestamp(). |