Troubleshooting DateTime

From WeBWorK_wiki
Jump to navigation Jump to search

DateTime won't build[edit]

  • In building DateTime on some computers you may need to install Module::Build first.
  • In some cases installations have had to reset the environment variable LANG in order to get Module::Build to compile. Use export LANG=C (sh/bash) or setenv LANG C (csh/tcsh).

Time zone is not detected[edit]

The can cause the following problems:

  • Obvious errors about the time zone not being found.
  • When printing hardcopy with the "Show Correct Answers" option enabled, users get an error message similar to HASH(0x18fa4348) in the subroutine DateTime::TimeZone::new.

DateTime tries to calculate the time zone in various ways from data available on the server. These methods can fail and cause seemingly-unrelated errors, for example in printing hardcopy.

To work around this, set the variable $siteDefaults{timezone} in global.conf to a valid time zone. For example:

$siteDefaults{timezone} = "America/New_York";

Further information is available in global.conf. Search for timezones. globalconf also contains instructions for finding the appropriate name for your local time zone. The command to list all time zone names is:

perl -MDateTime::TimeZone -e 'print join "\n", DateTime::TimeZone::all_names';