public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: Different representations of time in ls -l and date(1)
Date: Wed, 31 Aug 2016 17:41:00 -0000	[thread overview]
Message-ID: <20160831155222.GE22389@calimero.vinschen.de> (raw)
In-Reply-To: <A45B1767F1002449A37508C2CC6003D736A379@DEFTHW99EJ1MSX.ww902.siemens.net>

[-- Attachment #1: Type: text/plain, Size: 2159 bytes --]

On Aug 31 15:23, Schwarz, Konrad wrote:
> > -----Original Message-----
> > > > 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*
> > > > $ date
> > > > Wed, Aug 31, 2016  1:39:35 PM
> > > > $ echo $LC_TIME
> > > >
> > > > $ echo $LANG
> > > > en_US.UTF-8
> > > >
> > > > Shouldn't they be using the same format?
> > >
> > > Further experimentation shows that they do indeed use the same format
> > > in the POSIX locale, (LANG=C), as required by that standard.
> > >
> > > However, I still think it is an ugly inconsistency for them to differ
> > > in the en_US.UTF-8 locale (which I assume is the default locale in
> > > Cygwin).
> > 
> > Still further investigation shows that on SUSE Linux, with
> > LANG=en_US.UTF-8, both of these utilities consistently, if counter-
> > intuitively, display 24 hour time.
> > 
> > So I think the problem lies in Cygwin's locale database.
> 
> [Cygwin's locale database is Windows' locale database]
> 
> On my Windows 7 machine, Control Panel, Region and Language, Formats shows
> Short time: h:mm tt
> Long time: h:mm:ss tt
> AM Symbol: AM
> PM Symbol: PM
> 
> This is the standard English (United States) setting.
> 24 hour format is represented in Windows by either H:mm or HH:mm.
> 
> Shouldn't ls -l therefore be using a 12 hour format?

Cygwin has a conversion routine, which converts the Windows date/time
input strings to POSIX-compatible strftime strings for digestion by
applicatrions calling nl_langinfo.

I just checked:

  Input:  "h:mm:ss tt"
  Output: "%l:%M:%S %p"

This looks pretty much like a 12hour AM?PM format to me.

If ls uses what Cygwin provides for the default time format, then it
does.  But note Eric's mail in this thread:
https://cygwin.com/ml/cygwin/2016-08/msg00630.html


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2016-08-31 15:52 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-31 16:28 Schwarz, Konrad
2016-08-31 17:41 ` Corinna Vinschen [this message]
  -- strict thread matches above, loose matches on Subject: below --
2016-08-31 14:48 Schwarz, Konrad
2016-08-31 15:01 ` Corinna Vinschen
2016-08-31 12:31 Schwarz, Konrad
2016-08-31 13:04 ` Markus Hoenicka
2016-08-31 14:23   ` Marco Atzeri
2016-08-31 14:37   ` Frank Farance
2016-08-31 15:23     ` Eric Blake
2016-08-31 15:23       ` Eric Blake
2016-08-31 16:42         ` Erik Soderquist
2016-08-31 21:11           ` cyg Simple
2016-08-31 15:51       ` Corinna Vinschen
2016-08-31 15:52     ` Brian Inglis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160831155222.GE22389@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).