command: use more standard time format for clock property

%k is not very standard. The manpage notes them as conforming to
"Olson's timezone package", and it's not standard C89, C99 or POSIX.
mingw doesn't provide it, and even some of the smaller Linux libcs
don't have support.

Use %H instead. This gives slightly different results, but I think
this is ok. Difference in behavior between these summarized:

  %k: "single digits are preceded by a blank"
  %H: "range 00 to 23"
This commit is contained in:
wm4 2013-06-14 00:46:28 +02:00
parent 118a2a359f
commit 60a0c450eb
1 changed files with 1 additions and 1 deletions

View File

@ -629,7 +629,7 @@ static int mp_property_clock(m_option_t *prop, int action, void *arg,
time_t t = time(NULL);
struct tm *tmp = localtime(&t);
if ((tmp != NULL) && (strftime(outstr, sizeof(outstr), "%k:%M", tmp) == 5))
if ((tmp != NULL) && (strftime(outstr, sizeof(outstr), "%H:%M", tmp) == 5))
return m_property_strdup_ro(prop, action, arg, outstr);
return M_PROPERTY_UNAVAILABLE;
}