Operating System - HP-UX
1832493 Members
5949 Online
110043 Solutions
New Discussion

Re: Change the date & time for current shell.

 
sav041329
Occasional Contributor

Change the date & time for current shell.

Folks

I am unable to reverse time by 24 hrs in my current shell ( ksh - HP-UX 11.00) . I can forward it though , by 24 hrs.

Thanks in advance
6 REPLIES 6
Sachin Patel
Honored Contributor

Re: Change the date & time for current shell.

Hi Sav,
What is the error message? Did you reboot the system after setting your time back.

#>set_parms date_time or use sam

Sachin
Is photography a hobby or another way to spend $
sav041329
Occasional Contributor

Re: Change the date & time for current shell.

I have logged in as non-root user and changing time only for my shell. So I do not see a need for reboot. I am not getting any error message either.
Sachin Patel
Honored Contributor

Re: Change the date & time for current shell.

Well then this is interesting. I don't know How you can keep two different time on one system. one for shell and one system clock.
Which command do you use to change shell time?

Sachin
Is photography a hobby or another way to spend $
A. Clay Stephenson
Acclaimed Contributor

Re: Change the date & time for current shell.

Hi,

I'm a little bit confused. Only root can use the date command to change the system date forwards, backwards, or sideways. Any user can use the date to display the date.

You may be talking about setting the TZ variable.

As root, if you change the date backwards, date should have prompted you if you really wanted to do this. Normally setting the date backwards is a bad thing since file timestamps can become dangerously invalid for determining things like is file a newer than file b.

Clay
If it ain't broke, I can fix that.
sav041329
Occasional Contributor

Re: Change the date & time for current shell.

Guys, thanks for such a quick turnaround.

I need to test a script that is supposed to run at specific time. So as a non-root user, I am trying to play around with TZ variable so as to fire the script. This change of date & time is effective for my current shell only and has not effect whatsoever on the system time. And yes, my timezone is EST5EDT.
A. Clay Stephenson
Acclaimed Contributor

Re: Change the date & time for current shell.

Hi again,

Bear in mind that timezones greater than 12 West of Greenwich or 12 East of Greenwich have no meaning. Most UNIX implementations will allow a TZ of plus/minus 24 hours but no more than that. They typically do a mod 24. If you are trying to use cron I doubt you will have much success testing it this way.

Clay
If it ain't broke, I can fix that.