Subject: bug#19874: 25.0.50; encode-time not working as expected

From: [email-masked] (Ashish SHUKLA)
Date: Fri, 27 Feb 2015 10:29:07 +0530

On Fri, 27 Feb 2015 03:51:00 +0100, Wolfgang Jenkner <[email-masked]> said:
| On Fri, Feb 27 2015, Ashish SHUKLA wrote:

|| Very strange.

| Looking at the configure options from your original report I notice that
| another difference (apart from the somewhat different FreeBSD 10
| revisions) is that I don't compile emacs with gconf, gsettings, dbus or
| gtk3.  I wonder if the bug is still present in, say, a minimally built
| emacs with X support, viz.,

| ./configure --without-all --with-x --with-x-toolkit=no

So, looks like you're right it only happens with X11 (Gtk3) build, and if I
invoke Emacs in '-nw', or with Xaw front-end, it does not happen as evident
From following tests:

Emacs in batch mode:

--8<---------------cut here---------------start------------->8---
emacs-25.0.50.20150206.5c9ad35f/src % ./emacs -Q -batch -eval '(progn (setenv "TZ" "Asia/Kolkata") (print (encode-time 44 42 6 15 2 2015 0 nil 0)))'                    
set_time_zone_rule ("(null)"); tzval = "tZ="; getenv ("TZ") -> (null)
set_time_zone_rule ("Asia/Kolkata"); tzval = "TZ=Asia/Kolkata"; getenv ("TZ") -> Asia/Kolkata
set_time_zone_rule ("XXX-0:00:00"); tzval = "TZ=XXX-0:00:00"; getenv ("TZ") -> XXX-0:00:00
oldtz=Asia/Kolkata tz=XXX-0:00:00 oldTZ=Asia/Kolkata TZ=XXX-0:00:00 2015-02-15 06:42:44 -1 -> set_time_zone_rule ("Asia/Kolkata"); tzval = "TZ=Asia/Kolkata"; getenv ("TZ") -> Asia/Kolkata
2015-02-15 06:42:44 0 = 1423982564
(21728 16356)
--8<---------------cut here---------------end--------------->8---

Emacs in interactive mode in curses:

--8<---------------cut here---------------start------------->8---
emacs-25.0.50.20150206.5c9ad35f/src % ./emacs -Q -nw -eval '(progn (setenv "TZ" "Asia/Kolkata") (print (encode-time 44 42 6 15 2 2015 0 nil 0)))'  >/tmp/foo.txt 2>&1
chateau.d.if!abbe:~/tinderbox/redports/editors/emacs-devel/work2/emacs-25.0.50.20150206.5c9ad35f/src λ cat /tmp/foo.txt
set_time_zone_rule ("(null)"); tzval = "tZ="; getenv ("TZ") -> (null)
set_time_zone_rule ("Asia/Kolkata"); tzval = "TZ=Asia/Kolkata"; getenv ("TZ") -> Asia/Kolkata
set_time_zone_rule ("XXX-0:00:00"); tzval = "TZ=XXX-0:00:00"; getenv ("TZ") -> XXX-0:00:00
oldtz=Asia/Kolkata tz=XXX-0:00:00 oldTZ=Asia/Kolkata TZ=XXX-0:00:00 2015-02-15 06:42:44 -1 -> set_time_zone_rule ("Asia/Kolkata"); tzval = "TZ=Asia/Kolkata"; getenv ("TZ") -> Asia/Kolkata
2015-02-15 06:42:44 0 = 1423982564
--8<---------------cut here---------------end--------------->8---

Emacs in interactive mode in X11 (GTK3):

--8<---------------cut here---------------start------------->8---
emacs-25.0.50.20150206.5c9ad35f/src % ./emacs -Q  -eval '(progn (setenv "TZ" "Asia/Kolkata") (print (encode-time 44 42 6 15 2 2015 0 nil 0)))'        
set_time_zone_rule ("(null)"); tzval = "tZ="; getenv ("TZ") -> (null)
set_time_zone_rule ("Asia/Kolkata"); tzval = "TZ=Asia/Kolkata"; getenv ("TZ") -> (null)
set_time_zone_rule ("XXX-0:00:00"); tzval = "TZ=XXX-0:00:00"; getenv ("TZ") -> (null)
oldtz=(null) tz=XXX-0:00:00 oldTZ=(null) TZ=(null) 2015-02-15 06:42:44 -1 -> set_time_zone_rule ("(null)"); tzval = "tZ="; getenv ("TZ") -> (null)
2015-02-15 06:42:44 0 = 1423962764
--8<---------------cut here---------------end--------------->8---

Emacs in interactive mode in X11 (Xaw) compiled with following ./configure line:

./configure --localstatedir=/var --without-compress-install --without-dbus --with-file-notification=gfile --without-gconf --without-gif --with-gnutls --without-gsettings --without-jpeg --without-m17n-flt --without-imagemagick --without-libotf --without-png --without-toolkit-scroll-bars --without-rsvg --without-tiff --with-x --without-xft --without-xim --with-xml2 --without-xpm --with-x-toolkit=athena --without-xaw3d --with-sound=oss --x-libraries=/usr/local/lib --x-includes=/usr/local/include --prefix=/usr/local --mandir=/usr/local/man --infodir=/usr/local/share/emacs/info/ --build=amd64-portbld-freebsd10.1

--8<---------------cut here---------------start------------->8---
emacs-25.0.50.20150206.5c9ad35f/src % ./emacs -Q  -eval '(progn (setenv "TZ" "Asia/Kolkata") (print (encode-time 44 42 6 15 2 2015 0 nil 0)))'        
set_time_zone_rule ("(null)"); tzval = "tZ="; getenv ("TZ") -> (null)
set_time_zone_rule ("Asia/Kolkata"); tzval = "TZ=Asia/Kolkata"; getenv ("TZ") -> Asia/Kolkata
set_time_zone_rule ("XXX-0:00:00"); tzval = "TZ=XXX-0:00:00"; getenv ("TZ") -> XXX-0:00:00
oldtz=Asia/Kolkata tz=XXX-0:00:00 oldTZ=Asia/Kolkata TZ=XXX-0:00:00 2015-02-15 06:42:44 -1 -> set_time_zone_rule ("Asia/Kolkata"); tzval = "TZ=Asia/Kolkata"; getenv ("TZ") -> Asia/Kolkata
2015-02-15 06:42:44 0 = 1423982564
--8<---------------cut here---------------end--------------->8---

HTH
-- 
Ashish SHUKLA

<bazza> contracts are no match for geniuses

Sent from my Emacs