From 0bac465653496c87cd3d63604f31f2704129e053 Mon Sep 17 00:00:00 2001 From: Steve Hollasch Date: Thu, 24 May 2018 01:02:10 -0700 Subject: [PATCH] Ready for release v2.1.0 --- CHANGELOG.md | 4 +-- test.cmd | 9 ++--- tests-accepted.txt | 21 ++++++------ timeprint.cpp | 82 +++++++++++++++++++++++----------------------- 4 files changed, 59 insertions(+), 57 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 850f354..bfd53ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,10 @@ Change Log for `timeprint` ================================================================================ -## v2.1.0 (In Progress) +## v2.1.0 (2018-05-24) - Indicate unknown DST status for calls to mktime(). - Print error message for unhandled explicit dates before 1970. - - Handle numeric prefix on %a format codes. + - New: Handle numeric prefix on %a format codes. ## v2.0.0 (2018-02-26) - Renamed from currtime to timeprint. diff --git a/test.cmd b/test.cmd index 3d37944..8bfaaee 100644 --- a/test.cmd +++ b/test.cmd @@ -94,10 +94,11 @@ call :test Percent sign = %%%%%%%% call :test Bogus codes: %%%%E%%%%f%%%%i%%%%J%%%%N%%%%P%%%%s%%%%v call :test Bogus codes: %%%%_a %%%%_z -call :test --timezone UTC --time 2000-01-01T00:00:00Z -call :test --timezone UTC --time 2000-01-02T03:04:05+67 -call :test --timezone UTC --time 2000-01-02T03:04:05-67:89 -call :test --timezone UTC --time 2000-01-02T03:04:05-6789 +call :test --timezone UTC --time 2000-01-01T00:00:00Z +call :test --timezone UTC --time 2000-01-02T03:04:05+67 +call :test --timezone UTC --time 2000-01-02T03:04:05-67:89 +call :test --timezone UTC --time 2000-01-02T03:04:05-6789 +call :test --timezone UTC --time 2000-01-01T12:00Z "%%%%1a %%%%2a %%%%3a %%%%4a %%%%5a %%%%6a %%%%7a %%%%8a %%%%9a %%%%20a" call :test --timezone PST+08 --time 2000-01-01T00:00:00Z "%%%%#c %%%%z %%%%Z" call :test --time 2000-01-01T00:00:00Z --time 2000-01-02T00:00:00Z "%%%%_S" diff --git a/tests-accepted.txt b/tests-accepted.txt index f3cc6a3..106c989 100644 --- a/tests-accepted.txt +++ b/tests-accepted.txt @@ -3,7 +3,8 @@ Acceptance Tests for `timeprint` -------------------------------------------------------------------------------- Test 1: [/?] -timeprint v2.0.0 | https://github.com/hollasch/timeprint + +timeprint v2.1.0 | https://github.com/hollasch/timeprint timeprint - Print time and date information usage: timeprint [--codeChar ] [-%] @@ -87,13 +88,13 @@ For additional help, use `--help `, where is one of: -------------------------------------------------------------------------------- [--help FORMATCODES] - Format Codes -------------- The following time format codes are supported: %a Abbreviated weekday name * + %a Weekday name, abbreviated to d characters (min 1) %A Full weekday name * %b Abbreviated month name * %B Full month name * @@ -155,7 +156,6 @@ For additional help, use `--help `, where is one of: -------------------------------------------------------------------------------- [-H timeSyntax] - Time Syntax ------------- @@ -212,9 +212,9 @@ For additional help, use `--help `, where is one of: -------------------------------------------------------------------------------- [/htimezone] - Time Zones ------------ + The time zone value may be specified with the TZ environment variable, or using the `--timezone` option. Time zones have the format `tzn[+|-]hh[:mm[:ss]][dzn]`, where @@ -256,7 +256,6 @@ For additional help, use `--help `, where is one of: -------------------------------------------------------------------------------- [--help examples] - Examples ---------- @@ -282,7 +281,6 @@ For additional help, use `--help `, where is one of: -------------------------------------------------------------------------------- [--help deltaTime] - Delta Time Formatting ----------------------- @@ -477,18 +475,21 @@ Bogus codes: %E%f%i%J%N%P%s%v [Bogus codes: %_a %_z] Bogus codes: %_a %_z -------------------------------------------------------------------------------- -[--timezone UTC --time 2000-01-01T00:00:00Z] +[--timezone UTC --time 2000-01-01T00:00:00Z] Saturday, January 01, 2000 00:00:00 -------------------------------------------------------------------------------- -[--timezone UTC --time 2000-01-02T03:04:05+67] +[--timezone UTC --time 2000-01-02T03:04:05+67] Thursday, December 30, 1999 08:04:05 -------------------------------------------------------------------------------- -[--timezone UTC --time 2000-01-02T03:04:05-67:89] +[--timezone UTC --time 2000-01-02T03:04:05-67:89] Tuesday, January 04, 2000 23:33:05 -------------------------------------------------------------------------------- -[--timezone UTC --time 2000-01-02T03:04:05-6789] +[--timezone UTC --time 2000-01-02T03:04:05-6789] Tuesday, January 04, 2000 23:33:05 -------------------------------------------------------------------------------- +[--timezone UTC --time 2000-01-01T12:00Z "%1a %2a %3a %4a %5a %6a %7a %8a %9a %20a"] +S Sa Sat Satu Satur Saturd Saturda Saturday Saturday Saturday +-------------------------------------------------------------------------------- [--timezone PST+08 --time 2000-01-01T00:00:00Z "%#c %z %Z"] Friday, December 31, 1999 16:00:00 -0800 PST -------------------------------------------------------------------------------- diff --git a/timeprint.cpp b/timeprint.cpp index a561424..7843083 100644 --- a/timeprint.cpp +++ b/timeprint.cpp @@ -990,7 +990,7 @@ bool printDeltaFunc ( //__________________________________________________________________________________________________ static auto help_general = LR"( -timeprint v2.1.0-beta | https://github.com/hollasch/timeprint +timeprint v2.1.0 | https://github.com/hollasch/timeprint timeprint - Print time and date information usage: timeprint [--codeChar ] [-%] @@ -1078,46 +1078,46 @@ static auto help_formatCodes = LR"( The following time format codes are supported: - %a Abbreviated weekday name * - %a Weekday name, abbreviated to d characters (min 1) - %A Full weekday name * - %b Abbreviated month name * - %B Full month name * - %c Date and time representation * - %C Year divided by 100 and truncated to integer (00-99) - %d Day of month as decimal number (01-31) - %D Short MM/DD/YY date, equivalent to %m/%d/%y - %e Day of the month, space-padded ( 1-31) - %F Short YYYY-MM-DD date, equivalent to %Y-%m-%d - %g Week-based year, last two digits (00-99) - %G Week-based year - %h Abbreviated month name (same as %b) * - %H Hour in 24-hour format (00-23) - %I Hour in 12-hour format (01-12) - %j Day of year as decimal number (001-366) - %m Month as decimal number (01-12) - %M Minute as decimal number (00-59) - %n New line character (same as '\n') - %p AM or PM designation - %r 12-hour clock time * - %R 24-hour HH:MM time, equivalent to %H:%M - %S Seconds as a decimal number (00-59) - %t Horizontal tab character (same as '\t') - %T ISO 8601 time format (HH:MM:SS) equivalent to %H:%M:%S - %u ISO 8601 weekday as number with Monday=1 (1-7) - %U Week number, first Sunday = week 1 day 1 (00-53) - %V ISO 8601 week number (01-53) - %w Weekday as decimal number, Sunday = 0 (0-6) - %W Week of year, decimal, Monday = week 1 day 1(00-51) - %x Date representation * - %X Time representation * - %y Year without century, as decimal number (00-99) - %Y Year with century, as decimal number - %z ISO 8601 offset from UTC in timezone (1 minute=1, 1 hour=100) - If timezone cannot be determined, no characters - %Z Time-zone name or abbreviation, empty for unrecognized zones * - %_... Delta time formats. See `--help deltaTime`. - %% Percent sign + %a Abbreviated weekday name * + %a Weekday name, abbreviated to d characters (min 1) + %A Full weekday name * + %b Abbreviated month name * + %B Full month name * + %c Date and time representation * + %C Year divided by 100 and truncated to integer (00-99) + %d Day of month as decimal number (01-31) + %D Short MM/DD/YY date, equivalent to %m/%d/%y + %e Day of the month, space-padded ( 1-31) + %F Short YYYY-MM-DD date, equivalent to %Y-%m-%d + %g Week-based year, last two digits (00-99) + %G Week-based year + %h Abbreviated month name (same as %b) * + %H Hour in 24-hour format (00-23) + %I Hour in 12-hour format (01-12) + %j Day of year as decimal number (001-366) + %m Month as decimal number (01-12) + %M Minute as decimal number (00-59) + %n New line character (same as '\n') + %p AM or PM designation + %r 12-hour clock time * + %R 24-hour HH:MM time, equivalent to %H:%M + %S Seconds as a decimal number (00-59) + %t Horizontal tab character (same as '\t') + %T ISO 8601 time format (HH:MM:SS) equivalent to %H:%M:%S + %u ISO 8601 weekday as number with Monday=1 (1-7) + %U Week number, first Sunday = week 1 day 1 (00-53) + %V ISO 8601 week number (01-53) + %w Weekday as decimal number, Sunday = 0 (0-6) + %W Week of year, decimal, Monday = week 1 day 1(00-51) + %x Date representation * + %X Time representation * + %y Year without century, as decimal number (00-99) + %Y Year with century, as decimal number + %z ISO 8601 offset from UTC in timezone (1 minute=1, 1 hour=100) + If timezone cannot be determined, no characters + %Z Time-zone name or abbreviation, empty for unrecognized zones * + %_... Delta time formats. See `--help deltaTime`. + %% Percent sign * Specifiers marked with an asterisk are locale-dependent.