![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Get date and time for past 1 hour from current date | spch2o | Shell Programming and Scripting | 5 | 08-29-2008 05:32 AM |
| Processing a log file based on date/time input and the date/time on the log file | primp | Shell Programming and Scripting | 4 | 03-16-2008 11:23 AM |
| Move A File With Same Date,don't Change The Desitination Dir Date | jee.ku2 | UNIX for Dummies Questions & Answers | 1 | 01-09-2008 01:42 PM |
| change time | anhtt | SUN Solaris | 3 | 12-17-2007 11:13 AM |
| change the time in AIX | rocker40 | UNIX for Dummies Questions & Answers | 1 | 03-15-2007 11:39 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Temporarily change the date / time
Hi -
I'd like to know if it's possible to change the time on a Unix box temporarily, do some stuff, and then set it back to the correct time. I'm testing some code that reads a time (in hours) from a config file, and does something at that time. I want to be able to run regression test scripts at any time. I envisage doing something like this: config file: trigger.hour=7 // do something at 07:00 Invoke regression test script at any time, eg 14:57 - Test script uses date to set the time to 06:59:59 - The code gets invoked when the system time reaches 07:00:00 - Check the right thing happened (test = pass or fail) - Set the time back to the correct current time (14:57 + ???) The simplest thing would be if there's a command that goes and finds out what the time is that I can use to reset the clock after my test. An alternative would be to save the current time, set it to the fake value, run the test, calculate how long the test lasted, and then set the time to (saved_time + elapsed_time) -- but I'm not sure how I would do all that in a shell script. Any ideas welcome! Thanks, Sam |
| Bookmarks |
| Tags |
| change, date, temporary |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|