override the system date-timestamp on the Unix servers


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers override the system date-timestamp on the Unix servers
# 1  
Old 09-26-2007
override the system date-timestamp on the Unix servers

I am looking for a tool that allows us to override the system date-timestamp on the Unix servers so that we can perform regression tests using the same set of scripts and data. CDS is an example of a system where the logic is very date/time dependent. It would make regression testing much easier and more reliable if we could always start the tests at the same date/time. I recall back in the Y2K days there was a tool that allowed us to do that on the Unisys mainframe, but not sure about Unix.
# 2  
Old 09-26-2007
disable NTP

set time to what you want
# 3  
Old 09-26-2007
Yes, a great suggestion but that requires screwing with the servers and rebooting before each test. I don't want to do that. I want the server to maintain its time so files created are time stamped appropriately. I want the utility to fake out the system so that when the code calls for the current date/time it gets what I want it to be. I want to be able to run multiple iterations of tests using current and past dates. Do you have any other suggestions? Thanks again for the prompt response! Smilie
# 4  
Old 09-26-2007
I doubt that you will find any option other that resetting the system's internal clock. But this does not require a reboot. Shut down cron, change the date, and restart cron.
# 5  
Old 09-26-2007
Quote:
Originally Posted by Perderabo
....But this does not require a reboot...
pthread_cond_timedwait() takes an absolute time, if you step back six months any threaded code waiting on one of these will wait six months.

Oh, and don't use NFS across time discontinuities.
# 6  
Old 09-27-2007
The system time is kept in the kernel, and maintained by it. The only other solution other than what Porter and Perderabo mentioned is to have a small dedicated time-warped box that runs without ntpd. Or play with TZ.

If whatever you're using DOES NOT use UTC, but calls libc localtime, then you can create a custom timezone. POSIX compliant systems are required to have ways to set timezones with almost any offset from UTC. Start all of your regressions in the special timezone. How you set up your timezone is totally system dependent (POSIX allows for three methods), but you should be able to accomplish this with TZ variable alone.

example my ZZT timezone:
Code:
$> export TZ=ZZT6:30:22
$> date
Thu Sep 27 07:25:51 ZZT 2007
$> export TZ=CST6CDT
$> date
Thu Sep 27 08:56:34 CDT 2007

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Compare date in .txt with system date and remove if it's lesser than system date

Can someone help me with the code wherein there is a file f1.txt with different column and 34 column have expiry date and I need to get that and compare with system date and if expiry date is <system date remove those rows and other rows should be moved to new file f2.txt . I don't want to delete... (2 Replies)
Discussion started by: Stuti
2 Replies

2. Shell Programming and Scripting

Convert date in dd mm yyyy format to UNIX timestamp

Hello All, I have a date in DD/MM/YYYY format. I am trying to convert this into unix timestamp. I have tried following: date -d $mydate +%s where mydate = 23/12/2016 00:00:00 I am getting following error: date: extra operand `+%s' Try `date --help' for more information. ... (1 Reply)
Discussion started by: angshuman
1 Replies

3. AIX

convert a specific date to a unix timestamp

hello, i have an AIX5.3 machine and i am writing a script to display some processes. inside the script i want to get the time that the process starts and convert it to a unix timestamp. is there a command that i can use to do that? i search the web but all i found is long scripts and it does... (4 Replies)
Discussion started by: omonoiatis9
4 Replies

4. Shell Programming and Scripting

Check if a date field has date or timestamp or date&timestamp

Hi, In a field, I should receive the date with time stamp in a particular field. But sometimes the vendor sends just the date or the timestamp or correctl the date&timestamp. I have to figure out the the data is a date or time stamp or date&timestamp. If it is date then append "<space>00:00:00"... (1 Reply)
Discussion started by: machomaddy
1 Replies

5. Shell Programming and Scripting

how to get what date was 28 days ago of the current system date IN UNIX

Hi, Anybody knows how to get what date was 28 days ago of the current system date through UNIX script. Ex : - If today is 28th Mar 2010 then I have to delete the files which arrived on 1st Mar 2010, (15 Replies)
Discussion started by: kandi.reddy
15 Replies

6. Shell Programming and Scripting

To convert a date(in string format) to unix timestamp

Hi All, I have a string like below. "Mar 31 2009" . I want to convert this to unix time . Also please let me know how to find the unix time for the above string minus one day. For Eg. if i have string "Mar 31 2009" i want to find the unix time stamp of "Mar 30 2009". Thanks in advance,... (11 Replies)
Discussion started by: girish.raos
11 Replies

7. UNIX for Dummies Questions & Answers

Unix timestamp to readable date

How would I convert a unix timestamp such as "1232144092" to a readable date such as "1/16/2009 10:14:28 PM" ? I thought I could use date, but I don't think so now.. Any help would be great!! (4 Replies)
Discussion started by: Rhije
4 Replies

8. UNIX for Advanced & Expert Users

AIX/awk date to unix timestamp

Hello, I am inside a awk script on AIX, I am feeding to awk ls -luNR i need to convert ls -u time format "month day h:m/yr" to Unix epoch time, POSIX time, or aka unix timestamp I do not have strftime funk in my awk, and i have to do this fast meaning that I cannot do a system call in the... (1 Reply)
Discussion started by: nullwhat
1 Replies

9. Shell Programming and Scripting

Compare date from db2 table to yesterday's Unix system date

I am currently running the following Korn shell script which works fine: #!/usr/bin/ksh count=`db2 -x "select count(*) from schema.tablename"` echo "count" I would like to add a "where" clause to the 2nd line that would allow me to get a record count of all the records from schema.tablename... (9 Replies)
Discussion started by: sasaliasim
9 Replies

10. AIX

date override

When the aix date function is called by a routine, is the date function 'aware' of the name of the routine that is calling it, such that if we had the source code of the date function, we could modify it so that it provides a date to the caller depending upon the identity of the calling routine.... (1 Reply)
Discussion started by: gerry shacter
1 Replies
Login or Register to Ask a Question