|
|
|
|
|
|
|
B.2
ANSI Date/Time Interface |
|
|
|
|
|
|
|
|
One of the primary difficulties of the SCDTL project is to define standards that are meaningful and useful but do not redefine or contradict those definitions regarding date and time already contained in the ANSI or ISO specification for C. |
|
|
|
|
|
|
|
|
Graphically, the task is basically one of drawing a line around C and then coloring up to the line without leaving gaps or slopping over. This job was tough in kindergarten, and it hasn't gotten any easier. |
|
|
|
|
|
|
|
|
SCDTL has identified those structures specifically concerned with dates and times in C and has provided a handful of functions that specifically convert dates/times expressed in those structures to and from equivalent SCDTL structures. Rather than attempting a broad and detailed mixing of C and SCDTL functions, the interface between them has been carefully delimited and prescribed. |
|
|
|
|
|
|
|
|
The DTLT_160.C test program defines the BIG_TIME structure as the general SCDTL equivalent of the tm structure and defines several functions for converting BIG_TIME to and from tm and validating values in the two structures. |
|
|
|
|
|
|
|
|
The DTLT_161.C test program compares some ANSI C date/time functions with corresponding SCDTL functions. The documentation for this program contains a more detailed explanation of the date roll-over problem in UNIX. |
|
|
|
|
|
|
|
|
For many different purposes, it is necessary to convert a local civil time to and from the equivalent Greenwich Meridian Time (GMT) or its replacement, UTC. |
|
|
|
|
|
|
|
|
The test program DTLT_175.C defines a structure, HMS_INFO, which formats time in hourminutesecond (HMS) format, and several functions that convert HMS to and from decimal days, time to decimal hours, and local civil time to UT. Local civil time (LCT) is the time observed in a particular time zone by the rules of the time zone scheme. It should not be confused with local mean time (LMT), which is the correct local time by the Sun, according to actual geographical longitude. |
|
|
|
|
|
|
|
|
The treatment of time zones in SCDTL will undoubtedly provoke controversy in some quarters. Time zones, at their usual level of presentation as bold lines on tiny global maps, give the superficial appearance of an ordered international standard. The appearance of order and standardization rapidly vanishes under scrutiny. |
|
|
|
|
|