Operating System - HP-UX
1849612 Members
6397 Online
104044 Solutions
New Discussion

Re: Will it impact by DST changes

 
san_intel3
Occasional Advisor

Will it impact by DST changes

We are using the following functions in the Time.h file
we are getting the time using make_time function and then adding the duration to it.

This the code we have:
Time current_time = make_time( "now" );
Duration thirty_days(30);
Time exp_date = current_time + thirty_days;
set_Expire_Date( exp_date.make_string("%m/%d/%Y") );


These are the definitions found in Time.h file


Time make_time(const char* p);

const Time& Time::operator+=(const Duration& right){
t += (time_t)seconds(right);
return *this;
}


So because of DST will it impact the above code??



2 REPLIES 2
Steven E. Protter
Exalted Contributor

Re: Will it impact by DST changes

Shalom,

I don't recommend running any time based software or daemons through this upgrade process.

I reccomment installing all requires software patches and java and then booting your system.

Then your program should operate correctly.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Dennis Handly
Acclaimed Contributor

Re: Will it impact by DST changes

I can't really see an issue. If you only want the day, and DST start and end are deferred to 2 am, then you can never have the wrong date.

But if this is all you are doing, you should immediately abandon Time(3) and use ctime(3):

#include
#include
int main() {
char buf[128];
time_t now = time(NULL);
time_t next_month = now + 30*24*3600; /* seconds in 30 days */
struct tm *p = localtime(&next_month);
int len = strftime(buf, sizeof(buf), "%m/%d/%Y", p);
printf("Next month is %s\n", buf);
return 0;
}