# # # patch "std_hooks.lua" # from [3b3f7e40220a98ad82b001f6fd2f871b8a1164ff] # to [34cd38845eba0c0119042987efbbd7b4d7d1b62f] # # patch "tests/commit_using__MTN_log/__driver__.lua" # from [6c332cd36e7f489cb92bfdddff76b7703d5cbe12] # to [0766c36af8bc95807f4a2dd2b752e0e97aadb38a] # # patch "tests/commit_using__MTN_log/commit_log_modified_return.lua" # from [563af655ad86ba719907f8d4d24a7174f90b15e7] # to [13f324e5f74d60c595cbf45b2eb5f85115829967] # # patch "unit-tests/dates.cc" # from [4b2e6adef983df5508957aa5642f67e00c7e97ce] # to [fc614466a2130277bb98e89db1398d6b85cde1a1] # ============================================================ --- std_hooks.lua 3b3f7e40220a98ad82b001f6fd2f871b8a1164ff +++ std_hooks.lua 34cd38845eba0c0119042987efbbd7b4d7d1b62f @@ -386,12 +386,12 @@ function get_date_format_spec(wanted) -- ISO 8601, no timezone conversion: "" --. if (wanted == "date_long" or wanted == "date_short") then - return "%F" + return "%x" end if (wanted == "time_long" or wanted == "time_short") then - return "%T" + return "%X" end - return "%F %T" + return "%x %X" end -- trust evaluation hooks ============================================================ --- tests/commit_using__MTN_log/__driver__.lua 6c332cd36e7f489cb92bfdddff76b7703d5cbe12 +++ tests/commit_using__MTN_log/__driver__.lua 0766c36af8bc95807f4a2dd2b752e0e97aadb38a @@ -4,7 +4,7 @@ check(get("commit_log_modified_return.lu check(get("commit_log.lua")) check(get("commit_log_modified_return.lua")) -writefile("_MTN/log", "Log entry") +writefile("_MTN/log", "Log Entry") writefile("input.txt", "version 0 of the file") check(mtn("add", "input.txt"), 0, false, false) ============================================================ --- tests/commit_using__MTN_log/commit_log_modified_return.lua 563af655ad86ba719907f8d4d24a7174f90b15e7 +++ tests/commit_using__MTN_log/commit_log_modified_return.lua 13f324e5f74d60c595cbf45b2eb5f85115829967 @@ -1,3 +1,3 @@ function edit_comment(user_log_file) function edit_comment(user_log_file) - return string.gsub(user_log_file, "Log entry", "Log Entry") + return user_log_file end ============================================================ --- unit-tests/dates.cc 4b2e6adef983df5508957aa5642f67e00c7e97ce +++ unit-tests/dates.cc fc614466a2130277bb98e89db1398d6b85cde1a1 @@ -252,9 +252,9 @@ UNIT_TEST(localtime_formats) { #define OK(d, f) do { \ string formatted = d.as_formatted_localtime(f); \ - L(FL("format '%s' local date '%s'\n") % f % formatted); \ date_t parsed = date_t::from_formatted_localtime(formatted, f); \ UNIT_TEST_CHECK(parsed == d); \ + L(FL("date %s formatted %s parsed %s\n") % d % formatted % parsed); \ } while (0) // can we fiddle with LANG or TZ here? @@ -267,15 +267,29 @@ UNIT_TEST(localtime_formats) date_t start("1901-12-13T20:45:52"); date_t end("2038-01-19T03:14:07"); + // The 'y' (year in century) specification is taken to specify a year in + // the 20th century by libc4 and libc5. It is taken to be a year in the + // range 1950-2049 by glibc 2.0. It is taken to be a year in 1969-2068 + // since glibc 2.1. + + // When a century is not otherwise specified, values in the range 69-99 + // refer to years in the twentieth century (1969-1999); values in the + // range 00-68 refer to years in the twenty-first century (2000-2068). + + // With glibc 2.1 or newer the 2 digit years in the %x format will fail + // for years before 1969 because strptime will assume they are in the 21st + // century. + date_t yy_ok("1969-01-01T00:00:00"); + // test roughly 2 days per month in this entire range for (date_t date = start; date <= end; date += MILLISEC(15*(DAY+HOUR+MIN+SEC))) { - L(FL("\niso 8601 date '%s'\n") % date); + L(FL("iso 8601 date '%s' end '%s'\n") % date % end); // these all seem to work with the test setup of LANG=C and TZ=UTC - OK(date, "%F %T"); // YYYY-MM-DD hh:mm:ss - OK(date, "%T %F"); // hh:mm:ss YYYY-MM-DD + OK(date, "%F %X"); // YYYY-MM-DD hh:mm:ss + OK(date, "%X %F"); // hh:mm:ss YYYY-MM-DD OK(date, "%d %b %Y, %I:%M:%S %p"); OK(date, "%a %b %d %H:%M:%S %Y"); OK(date, "%a %d %b %Y %I:%M:%S %p %z"); @@ -283,13 +297,13 @@ UNIT_TEST(localtime_formats) OK(date, "%Y-%m-%d %H:%M:%S"); OK(date, "%Y-%m-%dT%H:%M:%S"); - // these do not + if (date >= yy_ok) + { + OK(date, "%x %X"); // YY-MM-DD hh:mm:ss + OK(date, "%X %x"); // hh:mm:ss YY-MM-DD + } - //(date, "%x %X"); // YY-MM-DD hh:mm:ss - //(date, "%X %x"); // hh:mm:ss YY-MM-DD - //(date, "%+"); - - // posibly anything with a timezone label (%Z) will fail + // possibly anything with a timezone label (%Z) will fail //(date, "%a %d %b %Y %I:%M:%S %p %Z"); // the timezone label breaks this }