- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Time make_time(const char* str) setting the wrong ...
Operating System - Linux
1753675
Members
5314
Online
108799
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-24-2007 09:21 AM
тАО04-24-2007 09:21 AM
The server is running HPUX 11.11 with DST patch PHCO_36097.
Timezone on the server is EST-10EDT i.e. Australia-Eastern.
I wrote a simple program as below to
- get current time using time
- convert current time to Time object
- print Time object
- get a datetime string from screen
- convert to Time object
- print Time object
This program runs perfectly in US EST/EDT timezone, but timezone was completedly wrong under EST-10EDT timezone, see output below:
pumbaa:date
Wed Apr 25 07:19:39 EST 2007
pumbaa:/tmp/DST
current time is Wed Apr 25 07:19:45 2007
year:2007
month:04
day:25
hour:07
minute:19
second:45
timezone:EDT
Enter date string as mm/dd/yyyy?12/10/2007
Enter time string as hh:mm?8:8:8
String: 12/10/2007 8:8:8become:
year:2007
month:12
day:10
hour:08
minute:08
second:08
timezone:EST
Converting this time to time_t=1197238088
convert to string is Mon Dec 10 09:08:08 2007
What did I missed?
Timezone on the server is EST-10EDT i.e. Australia-Eastern.
I wrote a simple program as below to
- get current time using time
- convert current time to Time object
- print Time object
- get a datetime string from screen
- convert to Time object
- print Time object
This program runs perfectly in US EST/EDT timezone, but timezone was completedly wrong under EST-10EDT timezone, see output below:
pumbaa:date
Wed Apr 25 07:19:39 EST 2007
pumbaa:/tmp/DST
current time is Wed Apr 25 07:19:45 2007
year:2007
month:04
day:25
hour:07
minute:19
second:45
timezone:EDT
Enter date string as mm/dd/yyyy?12/10/2007
Enter time string as hh:mm?8:8:8
String: 12/10/2007 8:8:8become:
year:2007
month:12
day:10
hour:08
minute:08
second:08
timezone:EST
Converting this time to time_t=1197238088
convert to string is Mon Dec 10 09:08:08 2007
What did I missed?
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-24-2007 02:25 PM
тАО04-24-2007 02:25 PM
Solution
(I'm having this moved to Languages, since it is unlikely anybody would know what you are asking.)
You are using the obsolete USL Standard Components. This was only made available for users porting from cfront and they were told to immediately port to the C++ Standard Lib instead. In the case of Time, you should be using the Standard C ctime(3).
You should NOT be using the Time component since it ONLY supports US timezones DST transitions. See Place(3). Note RWZone has similar issues.
Since you in the southern hemisphere, this will not work for you at all.
Some of this info is documented on:
http://h21007.www2.hp.com/dspp/files/unprotected/DST2.pdf
You are using the obsolete USL Standard Components. This was only made available for users porting from cfront and they were told to immediately port to the C++ Standard Lib instead. In the case of Time, you should be using the Standard C ctime(3).
You should NOT be using the Time component since it ONLY supports US timezones DST transitions. See Place(3). Note RWZone has similar issues.
Since you in the southern hemisphere, this will not work for you at all.
Some of this info is documented on:
http://h21007.www2.hp.com/dspp/files/unprotected/DST2.pdf
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-25-2007 08:39 AM
тАО04-25-2007 08:39 AM
Re: Time make_time(const char* str) setting the wrong timezone for Australia-Eastern
Dennis,
This is the first time I heard about the limitation of Time.
I guess I will have to change to use ctime related function instead.
Thanks.
-Peyhwa
This is the first time I heard about the limitation of Time.
I guess I will have to change to use ctime related function instead.
Thanks.
-Peyhwa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-25-2007 11:20 AM
тАО04-25-2007 11:20 AM
Re: Time make_time(const char* str) setting the wrong timezone for Australia-Eastern
>This is the first time I heard about the limitation of Time.
Well, it has always been there under Place(3). And if you ever tried it, it should be off by 1 hour, nearly all of the year.
Also, lib++.a is not available on Integrity.
Well, it has always been there under Place(3). And if you ever tried it, it should be off by 1 hour, nearly all of the year.
Also, lib++.a is not available on Integrity.
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP