Loading ...
Sorry, an error occurred while loading the content.
 

Problem with date and timezones in uNSLUng

Expand Messages
  • olangelsa
    Dear NSLU community, I have a question that I am hoping you can help me with. When I manually run date in the terminal (ssh) of my NSLU, the time is
    Message 1 of 2 , May 30, 2008
      Dear NSLU community,

      I have a question that I am hoping you can help me with.

      When I manually run "date" in the terminal (ssh) of my NSLU, the time
      is displayed using the correct timezone, that is CEST. But when I
      call "date" from a .cgi script, the time is displayed using another
      timezone, UTC.

      Does anybody know how I could correct this matter, so that output of
      date would be using the CEST timezone, regardless of how "date" is
      invoked?

      Thanks in advance.

      Xivind
    • Mike (mwester)
      ... There are two ways that a timezone is most often set. One means is to have the file /etc/localtime contain the timezone data for the correct timezone
      Message 2 of 2 , Jun 1, 2008
        olangelsa wrote:
        > Dear NSLU community,
        >
        > I have a question that I am hoping you can help me with.
        >
        > When I manually run "date" in the terminal (ssh) of my NSLU, the time
        > is displayed using the correct timezone, that is CEST. But when I
        > call "date" from a .cgi script, the time is displayed using another
        > timezone, UTC.
        >
        > Does anybody know how I could correct this matter, so that output of
        > date would be using the CEST timezone, regardless of how "date" is
        > invoked?

        There are two ways that a timezone is most often set. One means is to have the
        file /etc/localtime contain the timezone data for the correct timezone (this can
        be done by copying in the file, but is often done by having /etc/localtime be a
        symbolic link to the timezone file:

        /etc/localtime -> /usr/share/zoneinfo/America/Chicago

        The other means is to set an environment variable named "TZ" to a
        specially-coded string that represents the timezone. Usually this value is the
        timezone name and it's offset from UTC, but it can also be extended to encode
        daylight savings time.

        These mechanisms are used by the system libraries, and should be common to all
        normal commands and scripting languages. So I would suspect that perhaps you
        have set the TZ environment variable in your login environment, and it is not
        picked up by the CGI script. Try setting the variable in the CGI script as well.


        > Thanks in advance.
        >
        > Xivind

        Mike (mwester)
      Your message has been successfully submitted and would be delivered to recipients shortly.