This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Subtracting Time from strftime

Old posts that have not been replied to for several years.
Locked
D
Darkj
Halfop
Posts: 86
Joined: Sun Jul 06, 2003 9:58 pm

Subtracting Time from strftime

Post by Darkj »

Ok, right now in my script, to mark the current time, it uses [strftime %H:%M]. Now my question is, how would I go about taking that time, subtracting 10 minutes off it, then writing the time.

This is all part of my server status script for a webpage. But the webpage has a 10 minute delay. And I want to be able to write to file the RIGHT time the server came up, not 10 mins after it came up.

Help would be greatly appreciated.
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

To write the current time - 10 minutes:

Code: Select all

strftime %H:%M [expr {[clock seconds]-600}]
To subtract 10 minutes from an existing timestamp:

Code: Select all

strftime %H:%M [expr {[clock scan $theStamp]-600}]
Have you ever read "The Manual"?
Locked