datetime: parse timezone abbreations
Use our own list of generated timezone names for symbol table initialization, and then use this symbol table for datetime suffix parsing without format. Also, use newly integrated timezone names lookup functions in the `tnt_strptime` if `%Z` flag was ordered. Return corresponding `tm_gmtoff` (datetime->tzoffset) and `tm_tzindex` (datetime->tzindex) for later consumption. At the moment we could test only non-ambiguous abbreviations, which might be converted to tzoffset in a deterministic way. i.e. 'MSK' is always +0300, or 'MSD' is always +0400, but 'AT' may be either 'Alaska Time' (-0900) or 'Atlantic Time' (-0400/-0300) thus there is no (yet) any simple way to translate to their offset. NO_DOC=yet NO_CHANGELOG=yet
Showing
- src/lib/core/datetime.c 19 additions, 3 deletionssrc/lib/core/datetime.c
- src/lib/tzcode/CMakeLists.txt 1 addition, 1 deletionsrc/lib/tzcode/CMakeLists.txt
- src/lib/tzcode/strptime.c 11 additions, 11 deletionssrc/lib/tzcode/strptime.c
- src/lib/tzcode/timezone.c 106 additions, 0 deletionssrc/lib/tzcode/timezone.c
- src/lib/tzcode/timezone.h 42 additions, 0 deletionssrc/lib/tzcode/timezone.h
- src/lib/tzcode/tzcode.h 2 additions, 2 deletionssrc/lib/tzcode/tzcode.h
- test/app-tap/datetime.test.lua 75 additions, 1 deletiontest/app-tap/datetime.test.lua
Loading
Please register or sign in to comment