From: Vladimir Zolotykh
Subject: DST for the EU
Date: 
Message-ID: <20060403101853.0d11f4c7.gsmith@eurocom.od.ua>
Daylight Saving Time begins for most of the United States at 2:00
a.m. on the first Sunday of April. So

  (- (encode-universal-time 0 0 3 2 4 2006) (encode-universal-time 0 0 2 2 4 2006)) => 0

This is kind of embedded in CL I guess? However I am located and
running CL in the country where the Summer Time begins at 1:00 am UT
the last Sunday in March (26th March this year). Hence, here when I am
I'd like to get

  (- (encode-universal-time 0 0 4 26 3 2006) (encode-universal-time 0 0 3 26 3 2006)) => 0

however I get 3600 (I'm located in Ukraine, EET and EEST time zones in
winter and summer respectively).

The question is: is it possible to get the Daylight Saving Time
behaviour in CL appropriate for the European Union? And if possille
would you kindly tell me how? With my restricted knowledge I'd guess
that the Operating System information about locale and time-zone could
be used for that.

I could use optional TIME-ZONE argument in the calls to
ENCODE-UNIVERSAL-TIME but this gives me no DST at all.

Time-zone, locale are set correct in my system.

Using ACL80 on x86 box

-- 
Vladimir Zolotykh

From: Pascal Bourguignon
Subject: Re: DST for the EU
Date: 
Message-ID: <87fykuk8rs.fsf@thalassa.informatimago.com>
Vladimir Zolotykh <······@eurocom.od.ua> writes:

> Daylight Saving Time begins for most of the United States at 2:00
> a.m. on the first Sunday of April. So
>
>   (- (encode-universal-time 0 0 3 2 4 2006) (encode-universal-time 0 0 2 2 4 2006)) => 0
>
> This is kind of embedded in CL I guess? 

Not exactly.  If an implementation does it, it probably does it using
your OS facilities.  Namely on unix, using the TZ environment variable
and the corresponding time zone description.

> However I am located and running CL in the country where the Summer
> Time begins at 1:00 am UT the last Sunday in March (26th March this
> year). 

Did you set your environment variable TZ to reflect this location?
Or did you configure your system wide default time zone accordingly?


On my system, emacs M-x calendar RET reports:
2006- 3-26  March     26 Sunday   : Daylight Savings Time Begins 2:00am (CET)

and in clisp:

[1]> (- (encode-universal-time 0 0 3 2 4 2006) (encode-universal-time 0 0 2 2 4 2006))
3600
[2]> (- (encode-universal-time 0 0 3 26 3 2006) (encode-universal-time 0 0 2 26 3 2006))
0


> The question is: is it possible to get the Daylight Saving Time
> behaviour in CL appropriate for the European Union? 

Yes.

> And if possille
> would you kindly tell me how? 

What system are you using?

On linux systems, it's merely a matter of setting a symbolic link from
one of the files in /usr/sahre/zoneinfo to /etc/localtime:

$ ls -l /etc/localtime
lrwxrwxrwx    1 root     root           39 2006-04-03 16:52 /etc/localtime -> /usr/share/zoneinfo/posix/Europe/Madrid

If you don't have root access, you can merely set your TZ environment
variable:

$ echo $TZ
Europe/Madrid

> [...]
> I could use optional TIME-ZONE argument in the calls to
> ENCODE-UNIVERSAL-TIME but this gives me no DST at all.

Of course, but its more complex than that.  DST doesn't depend on the
time zone but on the political area.  You don't want to specify GMT+2,
you want to specify your exact country, of which the DST law is
compiled in the zoneinfo file.

> Time-zone, locale are set correct in my system.

Really, in that case it should be the fault of:

> Using ACL80 on x86 box

Try using clisp...


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

"You question the worthiness of my code? I should kill you where you
stand!"
From: Vladimir Zolotykh
Subject: Re: DST for the EU
Date: 
Message-ID: <20060404094355.659d3112.gsmith@eurocom.od.ua>
On Mon, 03 Apr 2006 16:56:23 +0200
Pascal Bourguignon <······@informatimago.com> wrote:

> Vladimir Zolotykh <······@eurocom.od.ua> writes:
> 
> > Daylight Saving Time begins for most of the United States at 2:00
> > a.m. on the first Sunday of April. So
> >
> >   (- (encode-universal-time 0 0 3 2 4 2006) (encode-universal-time 0 0 2 2 4 2006)) => 0
> >
> > This is kind of embedded in CL I guess? 
> 
> Not exactly.  If an implementation does it, it probably does it using
> your OS facilities.  Namely on unix, using the TZ environment variable
> and the corresponding time zone description.
> 
> > However I am located and running CL in the country where the Summer
> > Time begins at 1:00 am UT the last Sunday in March (26th March this
> > year). 
> 
> Did you set your environment variable TZ to reflect this location?
> Or did you configure your system wide default time zone accordingly?

I configured the system, e.g.  

  /etc/timezone 
  /etc/localtime 

files are set accordingly.  Do you know the ultimate way of checking
if the time zone is set correct in the system? I'm using libc 2.3.2.

> 
> 
> On my system, emacs M-x calendar RET reports:
> 2006- 3-26  March     26 Sunday   : Daylight Savings Time Begins 2:00am (CET)

Could you please tell me which Emacs version you're using?  M-x
calendar RET brings me just the *Calendar* window.  If I M-x
calendar-goto-date <RET> 2006 <RET> March <RET> 26 <RET> I see none of
your "Dayling..." message and don't know how to see it, sorry.

> 
> and in clisp:
> 
> [1]> (- (encode-universal-time 0 0 3 2 4 2006) (encode-universal-time 0 0 2 2 4 2006))
> 3600
> [2]> (- (encode-universal-time 0 0 3 26 3 2006) (encode-universal-time 0 0 2 26 3 2006))
> 0
> 
> 
> > The question is: is it possible to get the Daylight Saving Time
> > behaviour in CL appropriate for the European Union? 
> 
> Yes.
> 
> > And if possille
> > would you kindly tell me how? 
> 
> What system are you using?
> 
> On linux systems, it's merely a matter of setting a symbolic link from
> one of the files in /usr/sahre/zoneinfo to /etc/localtime:
> 
> $ ls -l /etc/localtime
> lrwxrwxrwx    1 root     root           39 2006-04-03 16:52 /etc/localtime -> /usr/share/zoneinfo/posix/Europe/Madrid
> 
> If you don't have root access, you can merely set your TZ environment
> variable:
> 
> $ echo $TZ
> Europe/Madrid
> 
> > [...]
> > I could use optional TIME-ZONE argument in the calls to
> > ENCODE-UNIVERSAL-TIME but this gives me no DST at all.
> 
> Of course, but its more complex than that.  DST doesn't depend on the
> time zone but on the political area.  You don't want to specify GMT+2,
> you want to specify your exact country, of which the DST law is
> compiled in the zoneinfo file.
> 
> > Time-zone, locale are set correct in my system.
> 
> Really, in that case it should be the fault of:
> 
> > Using ACL80 on x86 box
> 
> Try using clisp...
> 
> 
> -- 
> __Pascal Bourguignon__                     http://www.informatimago.com/
> 
> "You question the worthiness of my code? I should kill you where you
> stand!"


-- 
Vladimir Zolotykh
From: Pascal Bourguignon
Subject: Re: DST for the EU
Date: 
Message-ID: <87acb1h028.fsf@thalassa.informatimago.com>
Vladimir Zolotykh <······@eurocom.od.ua> writes:
> On Mon, 03 Apr 2006 16:56:23 +0200
> Pascal Bourguignon <······@informatimago.com> wrote:
>> Did you set your environment variable TZ to reflect this location?
>> Or did you configure your system wide default time zone accordingly?
>
> I configured the system, e.g.  
>
>   /etc/timezone 
>   /etc/localtime 
>
> files are set accordingly.  Do you know the ultimate way of checking
> if the time zone is set correct in the system? I'm using libc 2.3.2.

I'd run:

$ ls -l /etc/localtime 
lrwxrwxrwx    1 root     root           39 2006-04-03 16:52 /etc/localtime -> /usr/share/zoneinfo/posix/Europe/Madrid
$ (unset TZ; date)
Tue Apr  4 16:37:16 CEST 2006

to check that programs can see the local time zone configured in /etc.


and:

$ TZ=Europe/Kiev date
Tue Apr  4 17:41:42 EEST 2006

to check that the TZ environment variable works.


Note that merely changing /etc/localtime may not be enough to have it
taken into account by _running_ programs.  You may have to start the
program (emacs) again to have it reload the localtime file.


>> On my system, emacs M-x calendar RET reports:
>> 2006- 3-26  March     26 Sunday   : Daylight Savings Time Begins 2:00am (CET)
>
> Could you please tell me which Emacs version you're using?  M-x
> calendar RET brings me just the *Calendar* window.  If I M-x
> calendar-goto-date <RET> 2006 <RET> March <RET> 26 <RET> I see none of
> your "Dayling..." message and don't know how to see it, sorry.

I'm with emacs-version --> "22.0.50.1", but AFAIR, it has always
reported the DST dates.  If not, it's probably because of that
misconfiguration of /etc/localtime, I guess.


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

HEALTH WARNING: Care should be taken when lifting this product,
since its mass, and thus its weight, is dependent on its velocity
relative to the user.
From: Vladimir Zolotykh
Subject: Re: DST for the EU
Date: 
Message-ID: <20060404125633.6880d6f9.gsmith@eurocom.od.ua>
On Mon, 03 Apr 2006 16:56:23 +0200
Pascal Bourguignon <······@informatimago.com> wrote:

> Vladimir Zolotykh <······@eurocom.od.ua> writes:
> 
> > Daylight Saving Time begins for most of the United States at 2:00
> > a.m. on the first Sunday of April. So
> >
> >   (- (encode-universal-time 0 0 3 2 4 2006) (encode-universal-time 0 0 2 2 4 2006)) => 0
> >
> > This is kind of embedded in CL I guess? 
> 
> Not exactly.  If an implementation does it, it probably does it using
> your OS facilities.  Namely on unix, using the TZ environment variable
> and the corresponding time zone description.
> 
> > However I am located and running CL in the country where the Summer
> > Time begins at 1:00 am UT the last Sunday in March (26th March this
> > year). 
> 
> Did you set your environment variable TZ to reflect this location?
> Or did you configure your system wide default time zone accordingly?
> 
> 
> On my system, emacs M-x calendar RET reports:
> 2006- 3-26  March     26 Sunday   : Daylight Savings Time Begins 2:00am (CET)
> 
> and in clisp:
> 
> [1]> (- (encode-universal-time 0 0 3 2 4 2006) (encode-universal-time 0 0 2 2 4 2006))
> 3600
> [2]> (- (encode-universal-time 0 0 3 26 3 2006) (encode-universal-time 0 0 2 26 3 2006))
> 0
> 
> 
> > The question is: is it possible to get the Daylight Saving Time
> > behaviour in CL appropriate for the European Union? 
> 
> Yes.
> 
> > And if possille
> > would you kindly tell me how? 
> 
> What system are you using?
> 
> On linux systems, it's merely a matter of setting a symbolic link from
> one of the files in /usr/sahre/zoneinfo to /etc/localtime:
> 
> $ ls -l /etc/localtime
> lrwxrwxrwx    1 root     root           39 2006-04-03 16:52 /etc/localtime -> /usr/share/zoneinfo/posix/Europe/Madrid
Sorry, forgot to answer that question or yours, answering now:

  $ cmp /etc/localtime /usr/share/zoneinfo/Europe/Kiev 
  $ uname -a
  Linux Carina 2.4.27-1-386 #1 Fri Sep 3 06:24:46 UTC 2004 i686 GNU/Linux
  $ cat /etc/timezone 
  Europe/Kiev
  $ cmp /etc/localtime /usr/share/zoneinfo/Europe/Kiev 
  $ 

> 
> If you don't have root access, you can merely set your TZ environment
> variable:
> 
> $ echo $TZ
> Europe/Madrid
> 
> > [...]
> > I could use optional TIME-ZONE argument in the calls to
> > ENCODE-UNIVERSAL-TIME but this gives me no DST at all.
> 
> Of course, but its more complex than that.  DST doesn't depend on the
> time zone but on the political area.  You don't want to specify GMT+2,
> you want to specify your exact country, of which the DST law is
> compiled in the zoneinfo file.
> 
> > Time-zone, locale are set correct in my system.
> 
> Really, in that case it should be the fault of:
> 
> > Using ACL80 on x86 box
> 
> Try using clisp...
> 
> 
> -- 
> __Pascal Bourguignon__                     http://www.informatimago.com/
> 
> "You question the worthiness of my code? I should kill you where you
> stand!"


-- 
Vladimir Zolotykh
From: Frank Buss
Subject: Re: DST for the EU
Date: 
Message-ID: <1c93ui2ke47bf$.10902m3vpt19t.dlg@40tude.net>
Vladimir Zolotykh wrote:

> Daylight Saving Time begins for most of the United States at 2:00
> a.m. on the first Sunday of April. So
> 
>   (- (encode-universal-time 0 0 3 2 4 2006) (encode-universal-time 0 0 2 2 4 2006)) => 0

See

http://www.lispworks.com/documentation/HyperSpec/Body/25_adb.htm
http://en.wikipedia.org/wiki/Greenwich_Mean_Time

encode-universal-time uses GMT, so I think it would be an error, if it uses
DST offsets.

-- 
Frank Buss, ··@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de
From: Peder O. Klingenberg
Subject: Re: DST for the EU
Date: 
Message-ID: <ks64lp91ky.fsf@beto.netfonds.no>
Frank Buss <··@frank-buss.de> writes:

> encode-universal-time uses GMT, so I think it would be an error, if it uses
> DST offsets.

The return value from encode-universal-time is a universal time, yes,
and nobody disagrees that the universal time is in GMT.

However, the arguments to e-u-t corresponds to the return values from
decode-universal-time, and these are adjusted for local time zone and
DST.

<http://www.lispworks.com/documentation/HyperSpec/Body/f_encode.htm>
<http://www.lispworks.com/documentation/HyperSpec/Body/f_dec_un.htm>

...Peder...
-- 
It's not called hacking or trial and error!
It's called rapid prototyping and extreme programming.
  - Kristoffer Gleditsch
From: Frank Buss
Subject: Re: DST for the EU
Date: 
Message-ID: <8z3q6nriwent.1dvyac1ft053v$.dlg@40tude.net>
Peder O. Klingenberg wrote:

> The return value from encode-universal-time is a universal time, yes,
> and nobody disagrees that the universal time is in GMT.
> 
> However, the arguments to e-u-t corresponds to the return values from
> decode-universal-time, and these are adjusted for local time zone and
> DST.

Thanks, I misunderstood this, local time zone is applied. But there is no
way in Common Lisp to make sure that DST is applied:

| Implementation-dependent mechanisms for calculating when or if daylight 
| savings time is in effect for any given session. 

-- 
Frank Buss, ··@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de
From: Ivan Boldyrev
Subject: Re: DST for the EU
Date: 
Message-ID: <t0l9g3-3ba.ln1@ibhome.cgitftp.uiggm.nsc.ru>
On 9433 day of my life Vladimir Zolotykh wrote:
> Hence, here when I am I'd like to get
>
>   (- (encode-universal-time 0 0 4 26 3 2006)
>      (encode-universal-time 0 0 3 26 3 2006)) => 0
>
> however I get 3600 (I'm located in Ukraine, EET and EEST time zones in
> winter and summer respectively).

(- (encode-universal-time 0 0 3 26 3 2006)
   (encode-universal-time 0 0 2 26 3 2006)) => 0

It works in clisp 2.38 or CMUCL 19c or SBCL 0.9.9; Timezone is
Asia/Novosibirsk.

I tried it with ACL 7.0 Trial and it returns 3600 too.  Looks like ACL
bug.

-- 
Ivan Boldyrev

                       Perl is a language where 2 x 2 is not equal to 4.