[olug] Unix Tip: SOLARIS CHANGING SEASONS

Unix Guru Universe listserv at ugu.com
Sat Jul 5 16:35:46 UTC 2003


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

			      UNIX GURU UNIVERSE 
			         UNIX HOT TIP

			Unix Tip 2012 - July  5, 2003

		    http://www.ugu.com/sui/ugu/show?tip.today

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


SOLARIS CHANGING SEASONS

During a session, sometimes 
we have a need to change the
system time for our session 
only.  We have used it to 
simulate time based testing.

export TZ=ESThhEDT 

The EST set your time to Eastern 
Standard Time and EDT is Eastern 
Daylight Time.

hh is the number of hours you 
wish to change.

Example:  Currently the system 
date is  Tue Jun 19 13:38:03 EDT 2001 

and you wish to set it to 
yesterday at the same time.  
You would substitute a positive 
29 for hh.

export TZ=EST29EDT 

Now the shell time is:
Mon Jun 18 13:38:50 EDT 2001 

WHY 29 and not 24?  The main 
UNIX clock is set from GMT not
EST therefore you have to add 
5 hours to your backward 
calculations to get the same 
exact time since EST is 
GMT - 5 hours. 

Use negitive numbers to set 
the clock into the future. 

Also if you need to set the 
minutes and seconds  it is 
hh:mm:ss.  These are all the 
number of hours, minutes and
seconds from GMT that you wish 
to set. 

This is for Solaris 2.6, your 
mileage may vary.



--------------------------------------------------------------------------
To Subscribe:    http://www.ugu.com/sui/ugu/show?tip.subscribe
To Unsubscribe:  http://www.ugu.com/sui/ugu/show?tip.unsubscribe
To Submit A Tip: http://www.ugu.com/sui/ugu/show?tip.today

==========================================================================
DISCLAIMER: All UNIX HOT TIPS ARE OWNED BY THE UNIX GURU UNIVERSE AND ARE
NOT TO BE SOLD, PRINTED OR USED WITHOUT THE WRITTEN CONSENT OF THE UNIX 
GURU UNIVERSE. ALL TIPS ARE "USE AT YOUR OWN RISK". UGU  ADVISES THAT 
ALL TIPS BE TESTED IN A NON-PRODUCTION DEVELOPMENT ENVIRONMENT FIRST.

Unix Guru Universe - www.ugu.com - tips at ugu.com - Copyright 1994-2001
==========================================================================



More information about the OLUG mailing list