summaryrefslogtreecommitdiffstats
path: root/src/formats.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/formats.h')
-rw-r--r--src/formats.h30
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 ",
};