Re: time stamp format in log

grarpamp <[email protected]> Sat, 29 Jan 2022 22:52:12 -0500
Newsgroups gmane.mail.fetchmail.user
Message-ID <CAD2Ti29idv+GvzLyVuRNKry05r53gvTPE0aifhJP49UVREsPrA@mail.gmail.com>
What platform?

$ uname -a

What are the defaults?

$ env - locale
$ env - locale -k d_t_fmt
$ locale
$ locale -k d_t_fmt

The leading zero "03 PM" seems unusual at first sight,
perhaps check if it is platform specific...
     %0*   GNU libc extension.  Explicitly specify zero for padding.

https://pubs.opengroup.org/onlinepubs/9699919799/

>> https://wiki.archlinux.org/title/Locale#LC_TIME:_date_and_time_format
>> locale(7)
> No change.

LC_TIME can only pick from locales predefined in
the system, which may not contain what is sought.
And randomly picking different locales outside the
users locale, to get 24h or 8601, such as Arch
webpage suggests, can change other things along
with it, compare the definitions to see.

To get standard iso8601, or 24h, both of which are
nominally independent from language and country,
users may need to customize or create a locale.

Locale's honored only if the app calls the libraries.
See: sleeping at timestamp()

https://www.freebsd.org/cgi/man.cgi?query=localedef
https://www.freebsd.org/cgi/man.cgi?query=locale
https://www.freebsd.org/cgi/man.cgi?query=setlocale
https://www.freebsd.org/cgi/man.cgi?query=strftime
https://www.freebsd.org/cgi/man.cgi?query=environ


On that platform...

env - LC_ALL=C           TZ=UTC locale -k d_t_fmt
d_t_fmt="%a %b %e %H:%M:%S %Y"
env - LC_ALL=C           TZ=UTC ./fetchmail -v 127.0.0.1
fetchmail: 6.4.27 querying 127.0.0.1 (protocol auto) at Sun Jan 30
xx:xx:xx 2022: poll started

env - LC_ALL=en_GB.UTF-8 TZ=UTC locale -k d_t_fmt
d_t_fmt="%a %e %b %X %Y"
env - LC_ALL=en_GB.UTF-8 TZ=UTC ./fetchmail -v 127.0.0.1
fetchmail: 6.4.27 querying 127.0.0.1 (protocol auto) at Sun 30 Jan
xx:xx:xx 2022: poll started

env - LC_ALL=ru_RU.UTF-8 TZ=UTC locale -k d_t_fmt
d_t_fmt="%A, %e %B %Y г. %X"
env - LC_ALL=ru_RU.UTF-8 TZ=UTC ./fetchmail -v 127.0.0.1
fetchmail: 6.4.27 запрашивает 127.0.0.1 (протокол auto) на
воскресенье, 30 января 2022 г. xx:xx:xx: опрос начат

env - LC_ALL=iso8601     TZ=UTC locale -k d_t_fmt
d_t_fmt="%Y%m%dT%H%M%S%z"
env - LC_ALL=iso8601     TZ=UTC ./fetchmail -v 127.0.0.1
fetchmail: 6.4.27 querying 127.0.0.1 (protocol auto) at
20220130Txxxxxx+0000: poll started


8601 uses 24h per standard.
Existance of 8601 allows apps to advertise they are
using a standard format, that the world has agreed
through ISO process, by default for any timestamps
that may be present in the apps logs. But since there
are no such shipped LC_TIME, and locale does not split
between GUI and log, the apps have to do the log,
letting user override via some app config.
"Locales" are meant for use in equivalent of
human interface / display / GUI, but are pain
in the ass trying to make them serve for log
since they require reversing tools to do anything
programmatic with, if they are even parseable
at all due to other log problems in the apps.
People who never had to look at, digest, parse,
filter, sort, merge, store, extract, etc all sorts
of logs, unfortunately often may not yet appreciate
the wisdom of using 8601 for logs. 8601 serves
both the programming and reading purposes in logs.

YMMV...

cat */LC_TIME | sort | uniq -c | sort -nr
 131 %a %e %b %X %Y
  20 %a %b %e %X %Y
   8 %a %b/%e %T %Y
   4 %d %b %Y %X
   3 %x %A %X
   3 %b %d %Y %X
   3 %a %_m/%e %T %Y
   3 %Y - %b - %e %a %X
   2 %e. %b, %Y. gads %X
   2 %a %e %b %Y %X
   2 %a %d %b %Y %X
   2 %A, %e %B %Y �. %X
   1 %Y%m%dT%H%M%S%z
   1 %Y оны %B сарын %e, %A гараг, %X
   1 %A, %e %B %Y �. %X
   1 %A, %e %B %Y ի. %X
   1 %A, %e %B %Y �. %X
   1 %A, %e %B %Y ж. %X
   1 %A, %e %B %Y г. %X
   1 %A, %e %B %Y �. %X
   1 %A %e %B %Y %H:%M:%S
   1 %A %e %B %Y %H:%M.%S


_______________________________________________
Fetchmail-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fetchmail-users