Skip to content
Tcl Source Code View Ticket
Login

View Ticket

"clock format" with "%R" and "%r" mismatch

Closed / Fixed958bc05fbe38c74f73589eb48522a5ea8d96cc4aCreated 13 years agoUpdated 13 years ago
Descriptionhtml2014-05-13 07:45:45

Bug

The bug is, that the %r (AM/PM) clock format result contains seconds, while the format result with %R does not contain seconds.

Excerpt from the docs:

%r
On output, produces a locale-dependent time of day representation on a 12-hour clock. On input, accepts whatever %r produces.
%R
On output, produces a locale-dependent time of day representation on a 24-hour clock. On input, accepts whatever %R produces.

Example code:


    % info patch
    8.6.1
    % set secs 986140861
    986140861
    % clock format $secs -format %R
    18:01
    % clock format $secs -format %r
    06:01:01 pm

Referenced by2
jan.nijtmanswiki2014-05-13 11:21:55

Since Tcl's implementation corresponds with UNIX's strftime() function:

http://man7.org/linux/man-pages/man3/strftime.3.html

%r The time in a.m. or p.m. notation. In the POSIX locale this is equivalent to %I:%M:%S %p. (SU)
%R The time in 24-hour notation (%H:%M). (SU) For a version including the seconds, see %T below.

So, this is merely a documentation bug than an implementation bug. Fixed now.

Thanks!

Log in (anonymous is fine) to add a comment.