All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] toaster: fix timezone detection
@ 2014-03-12 13:41 Alex DAMIAN
  2014-03-12 16:06 ` Burton, Ross
  0 siblings, 1 reply; 7+ messages in thread
From: Alex DAMIAN @ 2014-03-12 13:41 UTC (permalink / raw)
  To: bitbake-devel; +Cc: Alexandru DAMIAN

From: Alexandru DAMIAN <alexandru.damian@intel.com>

This patch replaces faulty timezone detection with a version
that simply reads the TZ environment variable if it is set.

This has been tested with the list of TZ values from
http://en.wikipedia.org/wiki/List_of_tz_database_time_zones

	[YOCTO #5499]

Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
---
 bitbake/lib/toaster/toastermain/settings.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/toaster/toastermain/settings.py b/lib/toaster/toastermain/settings.py
index 51fa3cc..8be1851 100644
--- a/lib/toaster/toastermain/settings.py
+++ b/lib/toaster/toastermain/settings.py
@@ -51,8 +51,10 @@ ALLOWED_HOSTS = []
 # In a Windows environment this must be set to your system time zone.
 
 # Always use local computer's time zone
-import time
-TIME_ZONE = time.tzname[0]
+TIME_ZONE = "posix/GMT-0"               # have a sane default
+import os
+if 'TZ' in os.environ:
+    TIME_ZONE = os.environ['TZ']
 
 # Language code for this installation. All choices can be found here:
 # http://www.i18nguy.com/unicode/language-identifiers.html
-- 
1.8.3.2



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

* Re: [PATCH 1/1] toaster: fix timezone detection
  2014-03-12 13:41 [PATCH 1/1] toaster: fix timezone detection Alex DAMIAN
@ 2014-03-12 16:06 ` Burton, Ross
  2014-03-12 18:49   ` Damian, Alexandru
  2014-03-13  7:40   ` Stanacar, StefanX
  0 siblings, 2 replies; 7+ messages in thread
From: Burton, Ross @ 2014-03-12 16:06 UTC (permalink / raw)
  To: Alex DAMIAN; +Cc: bitbake-devel

On 12 March 2014 13:41, Alex DAMIAN <alexandru.damian@intel.com> wrote:
> This patch replaces faulty timezone detection with a version
> that simply reads the TZ environment variable if it is set.

My Debian system doesn't have a TZ environment variable but does have
/etc/localtime which is the current timezone data. Yes, determining
the local timezone is a pain.  :)

Ross


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

* Re: [PATCH 1/1] toaster: fix timezone detection
  2014-03-12 16:06 ` Burton, Ross
@ 2014-03-12 18:49   ` Damian, Alexandru
  2014-03-12 19:53     ` Burton, Ross
  2014-03-13 10:11     ` Paul Eggleton
  2014-03-13  7:40   ` Stanacar, StefanX
  1 sibling, 2 replies; 7+ messages in thread
From: Damian, Alexandru @ 2014-03-12 18:49 UTC (permalink / raw)
  To: Burton, Ross; +Cc: bitbake-devel

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

This is a Debian-ism :(

Does toaster show you improper times, or refuses to start ?

Alex


On Wed, Mar 12, 2014 at 4:06 PM, Burton, Ross <ross.burton@intel.com> wrote:

> On 12 March 2014 13:41, Alex DAMIAN <alexandru.damian@intel.com> wrote:
> > This patch replaces faulty timezone detection with a version
> > that simply reads the TZ environment variable if it is set.
>
> My Debian system doesn't have a TZ environment variable but does have
> /etc/localtime which is the current timezone data. Yes, determining
> the local timezone is a pain.  :)
>
> Ross
> ---------------------------------------------------------------------
> Intel Corporation (UK) Limited
> Registered No. 1134945 (England)
> Registered Office: Pipers Way, Swindon SN3 1RJ
> VAT No: 860 2173 47
>
> This e-mail and any attachments may contain confidential material for
> the sole use of the intended recipient(s). Any review or distribution
> by others is strictly prohibited. If you are not the intended
> recipient, please contact the sender and delete all copies.
>



-- 
Alex Damian
Yocto Project
SSG / OTC

[-- Attachment #2: Type: text/html, Size: 1772 bytes --]

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

* Re: [PATCH 1/1] toaster: fix timezone detection
  2014-03-12 18:49   ` Damian, Alexandru
@ 2014-03-12 19:53     ` Burton, Ross
  2014-03-13 10:11     ` Paul Eggleton
  1 sibling, 0 replies; 7+ messages in thread
From: Burton, Ross @ 2014-03-12 19:53 UTC (permalink / raw)
  To: Damian, Alexandru; +Cc: bitbake-devel

On 12 March 2014 18:49, Damian, Alexandru <alexandru.damian@intel.com> wrote:
> This is a Debian-ism :(
>
> Does toaster show you improper times, or refuses to start ?

I've never tried Toaster, but I'm in GMT so I wouldn't be able to tell :)

It may be a Debianism but TZ isn't set at all so that's equally
unreliable.  I wonder what time.tznames is actually doing.

/etc/localtime was originally a Debianism but is also the canonical
file that systemd handles, so it's got a much wider install base now.
The similar file that Fedora has used to be /etc/sysconfig/clock.

http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/trusty/jana/trusty/view/head:/libjana-ecal/jana-ecal-utils.c#L113
is the first hit for some code I was involved in some time ago that
tried to work everywhere.  It's probably bitrotted quite dramatically
though...

Ross


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

* Re: [PATCH 1/1] toaster: fix timezone detection
  2014-03-12 16:06 ` Burton, Ross
  2014-03-12 18:49   ` Damian, Alexandru
@ 2014-03-13  7:40   ` Stanacar, StefanX
  1 sibling, 0 replies; 7+ messages in thread
From: Stanacar, StefanX @ 2014-03-13  7:40 UTC (permalink / raw)
  To: Burton, Ross; +Cc: Damian, Alexandru, bitbake-devel




On Wed, 2014-03-12 at 16:06 +0000, Burton, Ross wrote:
> On 12 March 2014 13:41, Alex DAMIAN <alexandru.damian@intel.com> wrote:
> > This patch replaces faulty timezone detection with a version
> > that simply reads the TZ environment variable if it is set.
> 
> My Debian system doesn't have a TZ environment variable but does have
> /etc/localtime which is the current timezone data. Yes, determining
> the local timezone is a pain.  :)
> 
> Ross

FWIW, my Fedora 20 system doesn't have a TZ environment variable. It
uses the same /etc/localtime symbolic link as Debian.

Cheers,
Stefan

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

* Re: [PATCH 1/1] toaster: fix timezone detection
  2014-03-12 18:49   ` Damian, Alexandru
  2014-03-12 19:53     ` Burton, Ross
@ 2014-03-13 10:11     ` Paul Eggleton
  2014-03-13 11:24       ` Damian, Alexandru
  1 sibling, 1 reply; 7+ messages in thread
From: Paul Eggleton @ 2014-03-13 10:11 UTC (permalink / raw)
  To: Damian, Alexandru; +Cc: bitbake-devel

On Wednesday 12 March 2014 18:49:02 Damian, Alexandru wrote:
> This is a Debian-ism :(

You say that, but the Fedora 20 install I have here (a) doesn't have TZ and 
(b) has /etc/localtime -> ../usr/share/zoneinfo/Europe/London. On my CentOS 
6.5 machine (possibly irrelevant for Toaster, but...) TZ is also unset but 
/etc/localtime is just a plain copy of some timezone file rather than a 
symlink. Older RH-style systems such as CentOS 6 have a ZONE value in 
/etc/sysconfig/clock but Fedora appears to have eliminated this file.

Given that, I don't think this is a complete fix.

Cheers,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre


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

* Re: [PATCH 1/1] toaster: fix timezone detection
  2014-03-13 10:11     ` Paul Eggleton
@ 2014-03-13 11:24       ` Damian, Alexandru
  0 siblings, 0 replies; 7+ messages in thread
From: Damian, Alexandru @ 2014-03-13 11:24 UTC (permalink / raw)
  To: Paul Eggleton; +Cc: bitbake-devel

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

I hear you, thanks for the input on various configurations.

Please do not submit this patch, I'll come back with a v2.

Ross, I tried time.tzname (as it currently stands) and it doesn't provide a
/usr/share/zoneinfo/ compatible name :(.

Alex


On Thu, Mar 13, 2014 at 10:11 AM, Paul Eggleton <
paul.eggleton@linux.intel.com> wrote:

> On Wednesday 12 March 2014 18:49:02 Damian, Alexandru wrote:
> > This is a Debian-ism :(
>
> You say that, but the Fedora 20 install I have here (a) doesn't have TZ and
> (b) has /etc/localtime -> ../usr/share/zoneinfo/Europe/London. On my CentOS
> 6.5 machine (possibly irrelevant for Toaster, but...) TZ is also unset but
> /etc/localtime is just a plain copy of some timezone file rather than a
> symlink. Older RH-style systems such as CentOS 6 have a ZONE value in
> /etc/sysconfig/clock but Fedora appears to have eliminated this file.
>
> Given that, I don't think this is a complete fix.
>
> Cheers,
> Paul
>
> --
>
> Paul Eggleton
> Intel Open Source Technology Centre
>



-- 
Alex Damian
Yocto Project
SSG / OTC

[-- Attachment #2: Type: text/html, Size: 1770 bytes --]

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

end of thread, other threads:[~2014-03-13 11:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-12 13:41 [PATCH 1/1] toaster: fix timezone detection Alex DAMIAN
2014-03-12 16:06 ` Burton, Ross
2014-03-12 18:49   ` Damian, Alexandru
2014-03-12 19:53     ` Burton, Ross
2014-03-13 10:11     ` Paul Eggleton
2014-03-13 11:24       ` Damian, Alexandru
2014-03-13  7:40   ` Stanacar, StefanX

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.