unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* problem with time-stamps on GNU/Linux and Windows
@ 2008-09-04 11:02 Seweryn Kokot
  0 siblings, 0 replies; 9+ messages in thread
From: Seweryn Kokot @ 2008-09-04 11:02 UTC (permalink / raw)
  To: help-gnu-emacs

Hello,

Could you explain to me why I get slightly different time-stamps under
Windows and Linux? 

This is what I get in Linux

2008-08-19 wto 07:26

and under Windows I get

2008-08-05 Wt 11:44

Namely the problem is with %a - abbreviated day of week.

Here are the settings under Linux:

(locale-info 'codeset): "ISO-8859-2"
locale-coding-system: iso-latin-2

and under Windows I have

locale-coding-system: iso-latin-2
system-time-locale: iso-latin-2
system-message-locale: iso-latin-2
(locale-info 'codeset): "cp1250"

Under Linux iso-latin-2 is set by default and on Windows I have to put
the following in .emacs file

(setq locale-coding-system 'iso-latin-2)
(setq system-message-locale 'iso-latin-2)
(setq system-time-locale 'iso-latin-2)

otherwise these values are cp1250, nil and nil

I'm wondering why setting on windows (setq locale-coding-system 'iso-latin-2) has
no impact on (locale-info 'codeset) which still gives "cp1250"?

Any idea what should I do to get the same results on both operating systems?

Thanks in advance,
regards,
Seweryn





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: problem with time-stamps on GNU/Linux and Windows
       [not found] <mailman.18400.1220525633.18990.help-gnu-emacs@gnu.org>
@ 2008-09-04 13:00 ` Jason Rumney
  2008-09-04 17:27   ` ken
  0 siblings, 1 reply; 9+ messages in thread
From: Jason Rumney @ 2008-09-04 13:00 UTC (permalink / raw)
  To: help-gnu-emacs

On Sep 4, 7:02 pm, Seweryn Kokot <s.ko...@po.opole.pl> wrote:
> Hello,
>
> Could you explain to me why I get slightly different time-stamps under
> Windows and Linux?

These localized weekday names come from the system. No amount of
configuration within Emacs will make them the same in Windows as they
are in GNU/Linux.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: problem with time-stamps on GNU/Linux and Windows
  2008-09-04 13:00 ` problem with time-stamps on GNU/Linux and Windows Jason Rumney
@ 2008-09-04 17:27   ` ken
  2008-09-04 17:43     ` Eli Zaretskii
  2008-09-04 18:19     ` Seweryn Kokot
  0 siblings, 2 replies; 9+ messages in thread
From: ken @ 2008-09-04 17:27 UTC (permalink / raw)
  Cc: Help-gnu-emacs

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



On 09/04/2008 09:00 AM Jason Rumney wrote:
> On Sep 4, 7:02 pm, Seweryn Kokot <s.ko...@po.opole.pl> wrote:
>> Hello,
>>
>> Could you explain to me why I get slightly different time-stamps under
>> Windows and Linux?
> 
> These localized weekday names come from the system. No amount of
> configuration within Emacs will make them the same in Windows as they
> are in GNU/Linux.

I'm not quite understanding your problem.  And I don't often use
Windows.  But I would think that emacs should fetch the same couple
words (i.e., two bytes) representing the time regardless of which OS it
is running on.  But I'm guessing that the problem isn't the accuracy of
the time, but rather the human-readable output derived from those words.

I trust that you've read and understand the help on
"format-time-string"...  i.e.,

C-h f format-time-string [Return]


hth,
ken

- --
The significant problems we face cannot be solved at the
same level of thinking we were at when we created them.
	-- Albert Einstein
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)

iD8DBQFIwBpk8CeNiFrQkecRAqiUAJ9KqePfBDQBzKwH35JAEYpprqpYRQCfTBMl
SRmyj/ePHpuTgTJ3Ha1BXXg=
=HQqT
-----END PGP SIGNATURE-----




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: problem with time-stamps on GNU/Linux and Windows
  2008-09-04 17:27   ` ken
@ 2008-09-04 17:43     ` Eli Zaretskii
  2008-09-04 18:37       ` Seweryn Kokot
       [not found]       ` <mailman.18448.1220552912.18990.help-gnu-emacs@gnu.org>
  2008-09-04 18:19     ` Seweryn Kokot
  1 sibling, 2 replies; 9+ messages in thread
From: Eli Zaretskii @ 2008-09-04 17:43 UTC (permalink / raw)
  To: Help-gnu-emacs

> Date: Thu, 04 Sep 2008 13:27:00 -0400
> From: ken <gebser@mousecar.com>
> Cc: Help-gnu-emacs@gnu.org
> 
> >> Could you explain to me why I get slightly different time-stamps under
> >> Windows and Linux?
> > 
> > These localized weekday names come from the system. No amount of
> > configuration within Emacs will make them the same in Windows as they
> > are in GNU/Linux.
> 
> I'm not quite understanding your problem.  And I don't often use
> Windows.  But I would think that emacs should fetch the same couple
> words (i.e., two bytes) representing the time regardless of which OS it
> is running on.

The problem is not the time, but the abbreviated name of the second
day of the week ("Tue" in English).  These abbreviated names come from
a call to a library function, which are different on Windows and on
GNU/Linux, so they return different strings.

> But I'm guessing that the problem isn't the accuracy of
> the time, but rather the human-readable output derived from those words.

Emacs does not derive the names from those words, it simply returns
whatever the library functions hand it.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: problem with time-stamps on GNU/Linux and Windows
  2008-09-04 17:27   ` ken
  2008-09-04 17:43     ` Eli Zaretskii
@ 2008-09-04 18:19     ` Seweryn Kokot
  1 sibling, 0 replies; 9+ messages in thread
From: Seweryn Kokot @ 2008-09-04 18:19 UTC (permalink / raw)
  To: help-gnu-emacs

ken <gebser@mousecar.com> writes:

> On 09/04/2008 09:00 AM Jason Rumney wrote:
>> On Sep 4, 7:02 pm, Seweryn Kokot <s.ko...@po.opole.pl> wrote:
>>> Hello,
>>>
>>> Could you explain to me why I get slightly different time-stamps under
>>> Windows and Linux?
>> 
>> These localized weekday names come from the system. No amount of
>> configuration within Emacs will make them the same in Windows as they
>> are in GNU/Linux.
>
> I'm not quite understanding your problem.  And I don't often use
> Windows.  But I would think that emacs should fetch the same couple
> words (i.e., two bytes) representing the time regardless of which OS it
> is running on.  But I'm guessing that the problem isn't the accuracy of
> the time, but rather the human-readable output derived from those words.
>
> I trust that you've read and understand the help on
> "format-time-string"...  i.e.,
>
> C-h f format-time-string [Return]

I had read it before. I referred to %a from this help buffer. And the
problem is with the abbreviated name of the day of week. Under Linux I
get three-letter abbreviations (e.g. "wto" - "Tue") and under Windows -
two-letter abbrev (e.g. "Wt").

What I want is the three-letter abbreviation.

regards,
Seweryn





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: problem with time-stamps on GNU/Linux and Windows
  2008-09-04 17:43     ` Eli Zaretskii
@ 2008-09-04 18:37       ` Seweryn Kokot
  2008-09-04 19:04         ` ken
       [not found]       ` <mailman.18448.1220552912.18990.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 9+ messages in thread
From: Seweryn Kokot @ 2008-09-04 18:37 UTC (permalink / raw)
  To: help-gnu-emacs

Eli Zaretskii <eliz@gnu.org> writes:

>> >> Could you explain to me why I get slightly different time-stamps under
>> >> Windows and Linux?
>> > 
>> > These localized weekday names come from the system. No amount of
>> > configuration within Emacs will make them the same in Windows as they
>> > are in GNU/Linux.
>> 
>> I'm not quite understanding your problem.  And I don't often use
>> Windows.  But I would think that emacs should fetch the same couple
>> words (i.e., two bytes) representing the time regardless of which OS it
>> is running on.
>
> The problem is not the time, but the abbreviated name of the second
> day of the week ("Tue" in English).  These abbreviated names come from
> a call to a library function, which are different on Windows and on
> GNU/Linux, so they return different strings.
>
>> But I'm guessing that the problem isn't the accuracy of
>> the time, but rather the human-readable output derived from those words.
>
> Emacs does not derive the names from those words, it simply returns
> whatever the library functions hand it.

Well, (current-time-string) function returns the same strings on both systems,
but in English, for example: "Thu Sep  4 20:16:51 2008". BTW why this
function gives abbreviations in English and not the locale's ones?

Whereas this function

(defun my-insert-time-stamp ()
(interactive)
(insert (format-time-string "%a %b %d %02H:%02M:%02S %Y")))

on Windows gives
(my-insert-time-stamp)
Cz wrz 04 20:13:20 2008

and on GNU/Linux:
czw wrz 04 20:16:29 2008

I raise this problem because org-mode has some problems parsing these
inconsistent abbreviations.

Is it possible to get the result of (my-insert-time-stamp) in English
like in the case of the (current-time-string) function?

regards,
Seweryn





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: problem with time-stamps on GNU/Linux and Windows
  2008-09-04 18:37       ` Seweryn Kokot
@ 2008-09-04 19:04         ` ken
  2008-09-04 19:55           ` Seweryn Kokot
  0 siblings, 1 reply; 9+ messages in thread
From: ken @ 2008-09-04 19:04 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: Seweryn Kokot

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



On 09/04/2008 02:37 PM Seweryn Kokot wrote:
> Eli Zaretskii <eliz@gnu.org> writes:
> 
>>>>> Could you explain to me why I get slightly different time-stamps under
>>>>> Windows and Linux?
>>>> These localized weekday names come from the system. No amount of
>>>> configuration within Emacs will make them the same in Windows as they
>>>> are in GNU/Linux.
>>> I'm not quite understanding your problem.  And I don't often use
>>> Windows.  But I would think that emacs should fetch the same couple
>>> words (i.e., two bytes) representing the time regardless of which OS it
>>> is running on.
>> The problem is not the time, but the abbreviated name of the second
>> day of the week ("Tue" in English).  These abbreviated names come from
>> a call to a library function, which are different on Windows and on
>> GNU/Linux, so they return different strings.
>>
>>> But I'm guessing that the problem isn't the accuracy of
>>> the time, but rather the human-readable output derived from those words.
>> Emacs does not derive the names from those words, it simply returns
>> whatever the library functions hand it.
> 
> Well, (current-time-string) function returns the same strings on both systems,
> but in English, for example: "Thu Sep  4 20:16:51 2008". BTW why this
> function gives abbreviations in English and not the locale's ones?
> 
> Whereas this function
> 
> (defun my-insert-time-stamp ()
> (interactive)
> (insert (format-time-string "%a %b %d %02H:%02M:%02S %Y")))
> 
> on Windows gives
> (my-insert-time-stamp)
> Cz wrz 04 20:13:20 2008
> 
> and on GNU/Linux:
> czw wrz 04 20:16:29 2008
> 
> I raise this problem because org-mode has some problems parsing these
> inconsistent abbreviations.
> 
> Is it possible to get the result of (my-insert-time-stamp) in English
> like in the case of the (current-time-string) function?
> 
> regards,
> Seweryn

All I can say is that we're working with open source code.  It took a
little bit of time, but I just tracked down at least one place where the
dayname strings are defined.  On my system it's

(defvar calendar-day-name-array
  ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday"]
  "Array of capitalized strings giving, in order, the day names.")

(and apparently other places) in calendar.el.

I.e., just go in and change the names of the days to what you want.


Tell us if that does it... I'd be interested.

hth,
ken
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)

iD8DBQFIwDFW8CeNiFrQkecRAu+hAJ9H0pbac0fQI3/hxuBgZBbEQfDiNQCfabfj
FSODnxVVIKKRKMaWvHTIcn8=
=ymLD
-----END PGP SIGNATURE-----




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: problem with time-stamps on GNU/Linux and Windows
  2008-09-04 19:04         ` ken
@ 2008-09-04 19:55           ` Seweryn Kokot
  0 siblings, 0 replies; 9+ messages in thread
From: Seweryn Kokot @ 2008-09-04 19:55 UTC (permalink / raw)
  To: help-gnu-emacs

ken <gebser@mousecar.com> writes:

> All I can say is that we're working with open source code.  It took a
> little bit of time, but I just tracked down at least one place where the
> dayname strings are defined.  On my system it's
>
> (defvar calendar-day-name-array
>   ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday"]
>   "Array of capitalized strings giving, in order, the day names.")
>
> (and apparently other places) in calendar.el.
>
> I.e., just go in and change the names of the days to what you want.
>
>
> Tell us if that does it... I'd be interested.
>
> hth,
> ken

I have tried this on Windows and nothing changed. I even tried to customize
`calendar-day-abbrev-array' variable but still format-time-string %a gives
"Cz" for "Thu", also `calendar-abbrev-length' is set to 3. 

Seweryn





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: problem with time-stamps on GNU/Linux and Windows
       [not found]       ` <mailman.18448.1220552912.18990.help-gnu-emacs@gnu.org>
@ 2008-09-05  0:38         ` Giorgos Keramidas
  0 siblings, 0 replies; 9+ messages in thread
From: Giorgos Keramidas @ 2008-09-05  0:38 UTC (permalink / raw)
  To: help-gnu-emacs

On Thu, 04 Sep 2008 20:37:26 +0200, Seweryn Kokot <s.kokot@po.opole.pl> wrote:
> Well, (current-time-string) function returns the same strings on both
> systems, but in English, for example: "Thu Sep 4 20:16:51 2008". BTW
> why this function gives abbreviations in English and not the locale's
> ones?

Because this way the output is predictably formatted, and programs can
read it with a well-known, predefined format.  The `format-time-string'
function can be used for locale-aware results.

> Whereas this function
>
> (defun my-insert-time-stamp ()
>   (interactive)
>   (insert (format-time-string "%a %b %d %02H:%02M:%02S %Y")))
>
> on Windows gives
> (my-insert-time-stamp)
> Cz wrz 04 20:13:20 2008
>
> and on GNU/Linux:
> czw wrz 04 20:16:29 2008
>
> I raise this problem because org-mode has some problems parsing these
> inconsistent abbreviations.
>
> Is it possible to get the result of (my-insert-time-stamp) in English
> like in the case of the (current-time-string) function?

One way to get predictable timestamps in `my-insert-time-stamp' is to
temporarily alter the value of `system-time-locale':

    (defun my-insert-time-stamp ()
      (interactive)
      (insert (let ((system-time-locale "C"))
                (format-time-string "%a %b %d %02H:%02M:%02S %Y"))))

This will always use the "C" locale when displaying time, and the output
inserted by `my-insert-time-stamp' will be similar to:

    "Fri Sep 05 03:34:47 2008"

To make the timestamps inserted independent of the local timezone, it
may also be worth to call `format-time-string' with a third argument of
`T' to output the timestamp in UTC:

    (defun my-insert-time-stamp ()
      (interactive)
      (insert (let ((system-time-locale "C"))
                (format-time-string "%a %b %d %02H:%02M:%02S %Y" (current-time) t))))



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-09-05  0:38 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.18400.1220525633.18990.help-gnu-emacs@gnu.org>
2008-09-04 13:00 ` problem with time-stamps on GNU/Linux and Windows Jason Rumney
2008-09-04 17:27   ` ken
2008-09-04 17:43     ` Eli Zaretskii
2008-09-04 18:37       ` Seweryn Kokot
2008-09-04 19:04         ` ken
2008-09-04 19:55           ` Seweryn Kokot
     [not found]       ` <mailman.18448.1220552912.18990.help-gnu-emacs@gnu.org>
2008-09-05  0:38         ` Giorgos Keramidas
2008-09-04 18:19     ` Seweryn Kokot
2008-09-04 11:02 Seweryn Kokot

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).