Getting system time from CSM with TCL

Unanswered Question
Apr 18th, 2007
User Badges:

A further saga to my email script that I am writing. I am trying to read the time from the system and include this into an email that is sent when a server goes off line.


Have found the following code seems to do the right thing:


set SysTime [ clock format [ clock scan "8 hours" -base [clock seconds] ] -format "%x %X" ]


Certainly this returns the time and date, but it returns a time that is approximate 4 minutes earlier than the system time.


#show clock

09:02:08.195 WST Thu Apr 19 2007


SysTime value: APR 19 2007 08:58:25


Has anybody managed to get the time successfully and is there a better way?



Thanks

LP

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 0 (0 ratings)
Loading.
Jon Marshall Fri, 04/20/2007 - 05:54
User Badges:
  • Super Blue, 32500 points or more
  • Hall of Fame,

    Founding Member

  • Cisco Designated VIP,

    2017 LAN, WAN

Hi


Been a while since i did any TCL :-).


I tried your line on my 6500 and it came out with a completely different time, about 8 hours ahead.


I came up with this which seems to work


set SysTime [ clock format [ clock seconds ] ]


although this might not be what you want


HTH to some extent


Jon

lpassmore Sat, 04/21/2007 - 22:29
User Badges:

Thanks for the reply Jon

The -base 8 hours is to adjust for the time zone otherwise it is about 8 hours out. The problem is it should be exactly 8 hours not not "about" 8 hours. Be interesting to see if yours is about or exactly 8 hours out


Thanks

LP

Gilles Dufour Sun, 04/22/2007 - 01:16
User Badges:
  • Cisco Employee,

I believe this is normal.

The csm gets the time from the supervisor but synch is approximative. That is the synch interval is large.


Gilles.

Actions

This Discussion