Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. If you'd prefer to explore, try our test area to get started. And see here for current known issues.

Bronze

Getting system time from CSM with TCL

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

3 REPLIES
Hall of Fame Super Blue

Re: Getting system time from CSM with TCL

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

Bronze

Re: Getting system time from CSM with TCL

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

Cisco Employee

Re: Getting system time from CSM with TCL

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.

228
Views
0
Helpful
3
Replies