clock format [clock seconds] -gmt 1 – gives incorrect time

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf clock format [clock seconds] -gmt 1 – gives incorrect time

  • Creator
    Topic
  • #51187
    Sergey Sevastyanov
    Participant

      Hi all

      I ran into the following problem:

      Code:


      hcitcl>set time [clock seconds]
      1253045214
      hcitcl>clock format $time
      Tue Sep 15 4:06:54 PM Eastern Daylight Time 2009
      hcitcl>clock format $time -gmt 1
      Tue Sep 15 8:06:54 PM GMT 2009

      I am on Windows 2003, CL 5.7 (and therefore Tcl 8.4). I checked time zone settings in Windows and it set to “(GMT -05:00) Eastern Time (US&Canada)”. “Automatically adjust clock for daylight saving changes” option is selected.

      Running the same commands on my desktop PC (Win XP Professional) gives the same result – GMT is 1 hour off.

      On XP machine (with ActiveTcl 8.5) I tried the following commands:

      Code:


      % set time [clock seconds]
      1253046621
      % clock format $time -gmt 1
      Tue Sep 15 20:30:21 GMT 2009
      % clock format $time -timezone :UTC
      Tue Sep 15 20:30:21 UTC 2009
      % clock format $time -timezone :GMT
      Tue Sep 15 20:30:21 GMT 2009
      % clock format $time -locale LOCALE
      Tue Sep 15 16:30:21 EDT 2009

      So it is also 1 hour off for GMT.

      This affects Time Sent in Outlook for emails sent out of Cloverleaf.

      I have to use “-gmt 1” in clock format for smtp email, because Tcl 8.4 formats local time with “Eastern Daylight Time” (unlike EDT in Tcl 8.5). MS Exchange Server doesn’t understand “Eastern Daylight Time” so it assumes the time was given for GMT timezone and that makes Time Sent even worse.

      Does anyone know how to fix GMT time given by Tcl? I assume I could convert “Eastern Daylight Time” to “EDT” in my code but it just doesn’t seem right

      Any help will be appreciated

      Thanks

    Viewing 1 reply thread
    • Author
      Replies
      • #69100
        Charlie Bursell
        Participant

          http://wwp.greenwichmeantime.com/

          Will always give you the correct GMT time.  I have no problem on mt XP.

          tcl>clock format [clock seconds]

          Tue Sep 15 4:52:08 PM Central Daylight Time 2009

          tcl>clock format [clock seconds] -gmt 1

          Tue Sep 15 9:52:15 PM GMT 2009

          Of course this is Tcl 8.4.  There were some problems with the clock command up through 8.4.  It had to do with dates way back in the past or far into the future.  The problems were supposedly resolved in 8.5.  I have seen no reported problems with the GMT offset as long as the TIMEZONE was properly set.

          Since it is Tcl 8.5 and Cloverleaf users are using Tcl 8.4 you maybe should post your question on comp.lang.tcl

          You sure of your timezone setting?   😉

        • #69101
          Sergey Sevastyanov
          Participant

            Charlie

            Thank you for the link. So I was wrong about GMT – according to the link GMT (UTC) doesn’t change through the year. So London is now on BST (British Summer Time = GMT +1).

            That means that Tcl gives correct GMT time after all. So now I am completely confused why I get Sent time incorrect in Outlook.

            I wonder if this is Outlook/Exchange server problem or settings. But when I send email from Outlook to myself I get correct time. I also just sent email to my Outlook account from my private emai and the time is correct as well.

            I just tested this by sending email from Cloverleaf alerts by using “built-in” hcialert2email – but then again hcialert2email uses the same smtp.

            I will keep digging

        Viewing 1 reply thread
        • The forum ‘Cloverleaf’ is closed to new topics and replies.