diff options
author | P. J. McDermott <pj@pehjota.net> | 2022-03-22 18:46:20 (EDT) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2022-03-22 18:46:20 (EDT) |
commit | 50d117cb76883735faa8864c4978b5819cb167bd (patch) | |
tree | 4a3e2b44e66064dfffc7dc75e8fd70c954830be6 /src/formats.h | |
parent | e75ef778d29de6a66373dad8fdda32d33f0c9f52 (diff) | |
download | atsign-50d117cb76883735faa8864c4978b5819cb167bd.zip atsign-50d117cb76883735faa8864c4978b5819cb167bd.tar.gz atsign-50d117cb76883735faa8864c4978b5819cb167bd.tar.bz2 |
datetime, formats: Conform to strptime() space req
Diffstat (limited to 'src/formats.h')
-rw-r--r-- | src/formats.h | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/src/formats.h b/src/formats.h index f4caccd..262912e 100644 --- a/src/formats.h +++ b/src/formats.h @@ -25,6 +25,16 @@ * * All of the format strings in each array must be padded with spaces to be of * equal lengths. + * + * Conversion specifications are used by both strptime() and strftime(). As + * required by the former function, there shall be "white-space or other non- + * alphanumeric characters between any two conversion specifications unless all + * of the adjacent conversion specifications convert a known, fixed number of + * characters." [POSIX] The "^" character may be used to separate conversion + * specifications that should be separated (by a space) when parsing and + * adjacent when formatting for printing. For example, " %I^%M %p " will be + * changed to " %I %M %p " when parsing and to " %I%M %p " when formatting for + * printing. */ static const char *FORMATS_DATE[] = { @@ -220,10 +230,10 @@ static const char *FORMATS_TIME[] = { " %H.%M.%S ", /* 19.00.01 */ " %I.%M %p ", /* 7.00 PM */ " %H.%M ", /* 19.00 */ - " %I%M%S %p ", /* 70001 PM */ - " %H%M%S ", /* 190001 */ - " %I%M %p ", /* 700 PM */ - " %H%M ", /* 1900 */ + " %I^%M^%S %p ", /* 70001 PM */ + " %H^%M^%S ", /* 190001 */ + " %I^%M %p ", /* 700 PM */ + " %H^%M ", /* 1900 */ }; static const char *FORMATS_MISC[] = { @@ -231,13 +241,13 @@ static const char *FORMATS_MISC[] = { " %Y-%m-%dT%H:%M:%S ", " %Y-%m-%dT%H:%M ", /* ISO 8601: 19691231 delimited by "T" */ - " %Y%m%dT%H%M%S ", - " %Y%m%dT%H%M ", + " %Y^%m^%dT%H^%M^%S ", + " %Y^%m^%dT%H^%M ", /* 19691231 */ - " %Y%m%d %I%M%S %p ", - " %Y%m%d %H%M%S ", - " %Y%m%d %I%M %p ", - " %Y%m%d %H%M ", + " %Y^%m^%d %I^%M^%S %p ", + " %Y^%m^%d %H^%M^%S ", + " %Y^%m^%d %I^%M %p ", + " %Y^%m^%d %H^%M ", /* Wed Dec 31 19:00:01 1969 */ " %a %b %d %H:%M:%S %Y ", }; |