diff options
author | sebres <sebres@users.sourceforge.net> | 2017-01-10 22:36:19 (GMT) |
---|---|---|
committer | sebres <sebres@users.sourceforge.net> | 2017-01-10 22:36:19 (GMT) |
commit | 6a0616f572c4e550427bf6b6e80b874166c5e3fe (patch) | |
tree | 2c378980d604fa16faa34eff8ff96fdd4cc129b5 /generic/tclDate.h | |
parent | ca7dcb3b5163da655a13b5935c987b3a38067996 (diff) | |
download | tcl-6a0616f572c4e550427bf6b6e80b874166c5e3fe.zip tcl-6a0616f572c4e550427bf6b6e80b874166c5e3fe.tar.gz tcl-6a0616f572c4e550427bf6b6e80b874166c5e3fe.tar.bz2 |
cacheable conversions Local2UTC / UTC2Local fixed (some TZ switches time seconds bound) and optimized (last period ranges saved);
prepare to back-port clock format
Diffstat (limited to 'generic/tclDate.h')
-rw-r--r-- | generic/tclDate.h | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/generic/tclDate.h b/generic/tclDate.h index 9e1c506..112ed31 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -2,7 +2,7 @@ * tclDate.h -- * * This header file handles common usage of clock primitives - * between tclDate.c (yacc) and tclClock.c. + * between tclDate.c (yacc), tclClock.c and tclClockFmt.c. * * Copyright (c) 2014 Serg G. Brester (aka sebres) * @@ -317,22 +317,24 @@ typedef struct ClockClientData { Tcl_Obj *timezoneObj; TclDateFields Date; } lastBase; - /* Las-minute cache for fast UTC2Local conversion */ + /* Las-period cache for fast UTC2Local conversion */ struct { /* keys */ Tcl_Obj *timezoneObj; int changeover; Tcl_WideInt seconds; + Tcl_WideInt rangesVal[2]; /* Bounds for cached time zone offset */ /* values */ time_t tzOffset; Tcl_Obj *tzName; } UTC2Local; - /* Las-minute cache for fast Local2UTC conversion */ + /* Las-period cache for fast Local2UTC conversion */ struct { /* keys */ Tcl_Obj *timezoneObj; int changeover; Tcl_WideInt localSeconds; + Tcl_WideInt rangesVal[2]; /* Bounds for cached time zone offset */ /* values */ time_t tzOffset; } Local2UTC; @@ -372,8 +374,22 @@ typedef enum _CLCKTOK_TYPE { typedef struct ClockFmtScnStorage ClockFmtScnStorage; +typedef struct ClockFormatTokenMap { + unsigned short int type; + unsigned short int flags; + unsigned short int clearFlags; + unsigned short int minSize; + unsigned short int maxSize; + unsigned short int offs; + ClockScanTokenProc *parser; + void *data; +} ClockFormatTokenMap; typedef struct ClockFormatToken { - CLCKTOK_TYPE type; + ClockFormatTokenMap *map; + struct { + const char *start; + const char *end; + } tokWord; } ClockFormatToken; typedef struct ClockScanTokenMap { @@ -447,10 +463,14 @@ MODULE_SCOPE ClockFmtScnStorage * Tcl_Obj *objPtr); MODULE_SCOPE Tcl_Obj * ClockLocalizeFormat(ClockFmtScnCmdArgs *opts); + MODULE_SCOPE int ClockScan(ClientData clientData, Tcl_Interp *interp, register DateInfo *info, Tcl_Obj *strObj, ClockFmtScnCmdArgs *opts); +MODULE_SCOPE int ClockFormat(ClientData clientData, Tcl_Interp *interp, + register DateInfo *info, ClockFmtScnCmdArgs *opts); + MODULE_SCOPE void ClockFrmScnClearCaches(void); /* |