time/timezone setting

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mac11
    Contributor
    • Apr 2007
    • 256

    time/timezone setting

    I have an app that runs under Linux (centos and LFS flavors) and I'm having problems with reading the correct time after I change the timezone (by moving the link at /etc/localtime to point to the new timezone file)

    Basically, I use a call to time() to get the current time - and when I change the timezone while my app is running the call to time() does not reflect the new timezone unless I kill it and restart. Is there some environment variable or something that I need to update along with the timezone link?

    I posted this question under c/c++ programming too:
  • michaelb
    Recognized Expert Contributor
    • Nov 2006
    • 534

    #2
    I am not sure if this would solve your problem, but check whether TZ is defined in your environment:
    Code:
    mingus% echo $TZ
    US/Eastern
    mingus%

    Comment

    • michaelb
      Recognized Expert Contributor
      • Nov 2006
      • 534

      #3
      I probably missed the point here - changes to environment may not affect the running process, you have to restart it.

      Comment

      • mac11
        Contributor
        • Apr 2007
        • 256

        #4
        no no - setting TZ helped :)

        If I set TZ when I change the timezone everybody is happy

        Comment

        Working...