--- pl-5.6.17.orig/src/Tests/library/test_date.pl 2006-07-28 08:29:29.000000000 +1200 +++ pl-5.6.17/src/Tests/library/test_date.pl 2006-07-29 21:44:38.000000000 +1200 @@ -25,50 +25,50 @@ * TIME_FORMAT/3 TESTS * *******************************/ -ok(1152794050, '~a', 'Thu'). -ok(1152794050, '~A', 'Thursday'). -ok(1152794050, '~b', 'Jul'). -ok(1152794050, '~B', 'July'). -ok(1152794050, '~c', 'Thu Jul 13 14:34:10 2006'). -ok(1152794050, '~p', ['P', 'PM']). -%ok(1152794050, '~P', 'pm'). % non-standard -ok(1152794050, '~x', '07/13/06'). -ok(1152794050, '~X', '14:34:10'). -ok(1152794050, '~C', '20'). -ok(1152794050, '~d', '13'). -ok(1152794050, '~D', '07/13/06'). -ok(1152794050, '~e', '13'). +ok(1152794050, '%a', 'Thu'). +ok(1152794050, '%A', 'Thursday'). +ok(1152794050, '%b', 'Jul'). +ok(1152794050, '%B', 'July'). +ok(1152794050, '%c', 'Thu Jul 13 12:34:10 2006'). +ok(1152794050, '%p', ['P', 'PM']). +%ok(1152794050, '%P', 'pm'). % non-standard +ok(1152794050, '%x', '07/13/06'). +ok(1152794050, '%X', '12:34:10'). +ok(1152794050, '%C', '20'). +ok(1152794050, '%d', '13'). +ok(1152794050, '%D', '07/13/06'). +ok(1152794050, '%e', '13'). %ok(1152794050, '%E', ''). -ok(1152794050, '~F', '2006-07-13'). -ok(1152794050, '~g', '06'). -ok(1152794050, '~G', '2006'). -ok(1152794050, '~V', '28'). -ok(1152794050, '~h', 'Jul'). -ok(1152794050, '~H', '14'). -ok(1152794050, '~I', '02'). -ok(1152794050, '~j', '194'). -ok(1152794050, '~k', '14'). -ok(1152794050, '~l', ' 2'). -ok(1152794050, '~m', '07'). -ok(1152794050, '~M', '34'). -ok(1152794050, '~n', '\n'). -%ok(1152794050, '~O', ''). -ok(1152794050, '~r', '02:34:10 PM'). -ok(1152794050, '~R', '14:34'). -ok(1152794050, '~s', '1152794050'). -ok(1152794050, '~S', '10'). -ok(1152794050, '~t', '\t'). -ok(1152794050, '~T', '14:34:10'). -ok(1152794050, '~u', '4'). -ok(1152794050, '~U', '28'). -ok(1152794050, '~w', '4'). -ok(1152794050, '~W', '28'). -ok(1152794050, '~y', '06'). -ok(1152794050, '~Y', '2006'). -ok(1152794050, '~z', '+0200'). -ok(1152794050, '~Z', 'CEST'). -ok(1152794050, '~+', 'Thu Jul 13 14:34:10 2006'). -ok(1152794050, '~~', '~'). +ok(1152794050, '%F', '2006-07-13'). +ok(1152794050, '%g', '06'). +ok(1152794050, '%G', '2006'). +ok(1152794050, '%V', '28'). +ok(1152794050, '%h', 'Jul'). +ok(1152794050, '%H', '12'). +ok(1152794050, '%I', '00'). +ok(1152794050, '%j', '194'). +ok(1152794050, '%k', '12'). +ok(1152794050, '%l', ' 0'). +ok(1152794050, '%m', '07'). +ok(1152794050, '%M', '34'). +ok(1152794050, '%n', '\n'). +%ok(1152794050, '%O', ''). +ok(1152794050, '%r', '00:34:10 PM'). +ok(1152794050, '%R', '12:34'). +ok(1152794050, '%s', '1152794050'). +ok(1152794050, '%S', '10'). +ok(1152794050, '%t', '\t'). +ok(1152794050, '%T', '12:34:10'). +ok(1152794050, '%u', '4'). +ok(1152794050, '%U', '28'). +ok(1152794050, '%w', '4'). +ok(1152794050, '%W', '28'). +ok(1152794050, '%y', '06'). +ok(1152794050, '%Y', '2006'). +ok(1152794050, '%z', '-0000'). +ok(1152794050, '%Z', 'UTC'). +ok(1152794050, '%+', 'Thu Jul 13 12:34:10 2006'). +ok(1152794050, '%%', '%'). % test_format/0 % @@ -77,15 +77,16 @@ test_format :- setlocale(time, OldLocale, 'C'), - ( ok(Time, Fmt, Atom), - ( format_time(atom(A), Fmt, Time) + ( ok(TimeStamp, Fmt, Atom), + stamp_date_time(TimeStamp, DateTime, 'UTC'), + ( format_time(atom(A), Fmt, DateTime) -> ( ( A == Atom ; memberchk(A, Atom) ) -> true ; format('~q: got ~q, expected ~q~n', [Fmt, A, Atom]) ) - ; format('format_time(~q, ~q, ~q) failed~n', [atom(A), Fmt, Time]) + ; format('format_time(~q, ~q, ~q) failed~n', [atom(A), Fmt, DateTime]) ), fail ; true @@ -100,7 +101,7 @@ % test_date(+Date, +Time, -FormatTests). test_date(1970-1-1, 0:0:0.0, % Epoch - [ '~s' = '0' + [ '%s' = '0' ]). test_date(0-1-1, 0:0:0.0, []). % Year 0 test_date(2000-1-1, 0:0:0.0, []). % Year 2000 @@ -141,13 +142,13 @@ russian_day(A) :- setlocale(time, Old, 'ru_RU.utf8'), get_time(X), - format_time(atom(A), '~A', X), + format_time(atom(A), '%A', X), setlocale(time, _, Old). utc :- get_time(Stamp), stamp_date_time(Stamp, DateTime, 'UTC'), - format_time(current_output, '~F ~T ~Z', DateTime). + format_time(current_output, '%F %T %Z', DateTime). /******************************* * ERROR *