This is the mail archive of the
mailing list for the Cygwin project.
Re: Different representations of time in ls -l and date(1)
On 2016-08-31 07:04, Frank Farance wrote:
On 2016-08-31 08:09, Markus Hoenicka wrote:
At 2016-08-31 13:41, Schwarz, Konrad was heard to say:
Sorry for the previous incomplete mail.
So my problem is that date(1) outputs AM/PM style dates, whereas ls -l
uses 24 hour times.
$ ls -l rtos_benchmark.lst
-rwxr-xr-x+ 1 mchn1350 Domain Users 263 Aug 31 13:14 rtos_benchmark.lst*
Wed, Aug 31, 2016 1:39:35 PM
$ echo $LC_TIME
$ echo $LANG
Shouldn't they be using the same format?
date has a ton of options to format the output including the 12/24 h style, ,
see 'man date'.
You have misunderstood the question.
Question Intended: Why are they different?
Incorrectly Interpreted: There are lots of options for "ls" and "date".
I have everything in 24-hour format, yet my LC_TIME and LANG are the same as Konrad.
Furthermore, I'd say that the default output of "date" should look like the Linux one, which is the way it has looked on UNIX for about 40 years:
Linux: Wed Aug 31 08:56:10 EDT 2016
Cygwin: Wed, Aug 31, 2016 08:54:49
In other words, on Cygwin: get rid of the commas, put back the timezone.
POSIX specifies that locale settings are used by default in date and ls.
In the case of date, that appears to be Windows regional settings long date time, with
abbreviated words, as I have no idea where else it could be getting that custom format.
In ls, I appear to be getting the POSIX default.
POSIX also says that LC_ALL overrides LC_TIME overrides LANG, so if you have LC_ALL set,
you can only override it with LC_ALL e.g. "LC_ALL=C date" to get the default format.
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple