The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



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
Compare date from db2 table to yesterday's Unix system date sasaliasim Shell Programming and Scripting 9 12-01-2008 11:37 PM
File timestamp issue on HP servers siddaonline UNIX for Advanced & Expert Users 5 07-04-2007 11:09 AM
getting date from timestamp pavan_test UNIX for Dummies Questions & Answers 2 09-28-2006 12:01 PM
Command DATE in UNIX System ZINGARO UNIX for Dummies Questions & Answers 3 07-20-2006 05:07 PM
date override gerry shacter AIX 1 01-09-2006 01:42 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-26-2007
DavidH DavidH is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 2
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 (permalink)  
Old 09-26-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
disable NTP

set time to what you want
  #3 (permalink)  
Old 09-26-2007
DavidH DavidH is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 2
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!
  #4 (permalink)  
Old 09-26-2007
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
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 (permalink)  
Old 09-26-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
Quote:
Originally Posted by Perderabo View Post
....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 (permalink)  
Old 09-27-2007
jim mcnamara jim mcnamara is online now Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,716
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
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:35 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0