What standard is this "ISOTIME" structure?

In our code, we have a 16 byte packed struct

one that we call "ISOTIME":

typedef struct isotime {
    struct {
        uint16_t iso_zone : 12; // corresponding time zone
        uint16_t iso_type : 4; // type of iso date
    } iso_fmt;

    int16_t iso_year; // year
    uint8_t iso_month; // month
    uint8_t iso_day; // day
    uint8_t iso_hour; // hour
    uint8_t iso_minute; // minute
    uint8_t iso_second; // second
    uint8_t iso_centi; // centi-second
    uint8_t iso_hundred; // hundreds of micro-seconds
    uint8_t iso_micro; // micro-seconds
    uint32_t iso_unused; // pad out to 16 bytes
} ISOTIME; 

      

I am trying to figure out which standard should be implemented. Somebody knows? My google-fu is failing.

0


a source to share


3 answers


International standards rarely refer to verbose representations of data in memory, especially at the bit level (exceptions, of course, to floating point standards). This is due to the fact that such things are inherent. This does not mean that there is no standard for this framework, but I think this is unlikely.



+2


a source


According to Gary Ray, the primary standard for the exchange of date and time data is ISO 8601: 2004.

The presented data structure can handle the standard Gregorian calendar with a time resolution of up to microseconds.



There are other standards of relevance - for example, ISO / IEC 9899: 1999 (C). It defines a different structure and specifies the encoding for the years (for example, year number - 1900 is stored in tm_year, and also number of months starting at 0 for January through December 11 - useful to index into an array of month names, but disgusting otherwise). POSIX (ISO / IEC 9945-1: 2008) inherits its temporal processing from the C standard. SQL (ISO / IEC 9075-2: 2008) works more closely with ISO 8601 than with C / POSIX. But the structure shown can be used in any of these environments - although it is not standard in a C / POSIX environment.

+2


a source


Similar to the structure for handling ISO 8601 - the format depends on how the data is displayed:

20030103 = Basic Format
20030103T0700-0500 = Basic Format w/ Time and Zone
2003-01-03 = Extended Format 

      

+1


a source







All Articles