On HP-UX the '%k' produces the following result.
% clock format [clock seconds] -format "%k %l %s"
k l s
%
On Solaris I get the following.
% clock format [clock seconds] -format "%k %l %s"
16 4 %s
%
The problem appears to be that some of the time formats
are not part of the ANSI C standard for the strftime
command and therefore are not support on all platforms.
Note the following comment found on the OpenBSD's man
page: The `%G', `%g', `%k', `%l', `%s', and `%+'
conversion specifications are extensions.
Some comments form George Staplin.
Try: "make distclean && export CFLAGS=-DUSE_COMPAT &&
./configure && make" and test the generated tclsh with
%k. The configure command should probably check if %k
and the other extensions work and enable USE_COMPAT if
they don't. I would call it a bug if it isn't in the
clock.n man page. The clock.n for 8.4.2 doesn't mention
anything about the extensions, so I would label this a
bug.
Logged In: YES
user_id=99768
The reason that the native strftime is used on Unix
platforms is so that the extended localization options
%O and %E will be available. I had not realized that
HP-UX is so far behind the current POSIX that it
does not support %k, %l, or %s. I'd consider
that a bug, since they are documented in the [clock]
man page.
George's suggestion that configure.in check whether
the native strftime supports these options and fall
back upon USE_COMPAT if they do not is a good one.
A better one would be to localize compat/strftime.c
so that we don't need to worry about all the platform
differences. In fact, I had changed things in an
early 8.4 beta so that compat/strftime.c was used
on all platforms, but was forced to change back
under pressure from German Tcl'ers on Linux, who
needed localized dates.
The real fix is possible, but necessitates sorting out
some localization issues for the Tcl core. In essence,
there are chicken-and-egg problems with the loading
of message catalogs. There isn't anything insurmountable,
it's just that the individuals involved haven't had the
opportunity to sit down and have the necessary discussion.