aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@debian.org>2015-03-01 14:56:45 +0000
committerSimon McVittie <smcv@debian.org>2015-03-01 15:01:05 +0000
commit943ec015da20090a1ad42fb01f82817c86fd88d9 (patch)
treeeaa37af21faf0c64d0320553678e567b496795f8
parent5c7a62dbd59eeb6c228e7df2457d23a7237bf502 (diff)
downloadikiwiki-943ec015da20090a1ad42fb01f82817c86fd88d9.tar
ikiwiki-943ec015da20090a1ad42fb01f82817c86fd88d9.tar.gz
If neither timezone nor TZ is set, set both to :/etc/localtime if we're on a GNU system and that file exists, or GMT otherwise
-rw-r--r--IkiWiki.pm13
-rw-r--r--debian/changelog2
2 files changed, 14 insertions, 1 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm
index 7afd57993..f414996db 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -619,9 +619,20 @@ sub checkconfig () {
if (defined $config{timezone} && length $config{timezone}) {
$ENV{TZ}=$config{timezone};
}
- else {
+ elsif (defined $ENV{TZ} && length $ENV{TZ}) {
$config{timezone}=$ENV{TZ};
}
+ else {
+ eval q{use Config qw()};
+ error($@) if $@;
+
+ if ($Config::Config{d_gnulibc} && -e '/etc/localtime') {
+ $config{timezone}=$ENV{TZ}=':/etc/localtime';
+ }
+ else {
+ $config{timezone}=$ENV{TZ}='GMT';
+ }
+ }
if ($config{w3mmode}) {
eval q{use Cwd q{abs_path}};
diff --git a/debian/changelog b/debian/changelog
index fbb5e7f21..8dc5790fc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,6 +8,8 @@ ikiwiki (3.20150108) UNRELEASED; urgency=medium
bundle an old enough Encode.pm for that not to be a problem: the
system might have a newer Encode.pm installed separately, like Fedora 20.
(Closes: #776181; thanks, Anders Kaseorg)
+ * If neither timezone nor TZ is set, set both to :/etc/localtime if
+ we're on a GNU system and that file exists, or GMT otherwise
-- Joey Hess <id@joeyh.name> Sat, 24 Jan 2015 23:59:20 -0400