Skip to content

Commit

Permalink
What to do when there's no timezone-ish file.
Browse files Browse the repository at this point in the history
  • Loading branch information
jkeenan committed May 22, 2018
1 parent 832b6bd commit fda261b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lib/DateTime/TimeZone/Local/Unix.pm
Original file line number Diff line number Diff line change
Expand Up @@ -331,4 +331,22 @@ If this file exists, it is opened and we look for a line starting like
=back
B<Note:> Some systems such as virtual machine boxes may lack any of
these files. You can confirm that this is so by calling:
$ ls -l /etc/localtime /etc/timezone /etc/TIMEZONE \
/etc/sysconfig/clock /etc/default/init
If this is the case, then when checking for timezone handling you are
likely to get an exception:
$ perl -wle 'use DateTime; DateTime->now( time_zone => "local" )'
Cannot determine local time zone
In that case, you should consult your system F<man> pages as to how to address
that problem. In one such case reported to us, a FreeBSD virtual machine had
been built without any of these files. The user was able to run the FreeBSD
F<tzsetup> utility. That installed F</etc/localtime>, after which the above
timezone diagnostic ran silently, I<i.e.>, without throwing an exception.
=cut

0 comments on commit fda261b

Please sign in to comment.