- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: HP-UX shell or OE access to epoch secs
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
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
Community
Resources
Forums
Blogs
- 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
08-08-2006 02:36 PM - edited 10-29-2011 01:27 AM
08-08-2006 02:36 PM - edited 10-29-2011 01:27 AM
Re: HP-UX shell or OE access to epoch secs
>Sandman!: printf("%ld\n", time(ptloc));
There is no need to pass a parm to time(2). This also makes the kernel sweat because it has to validate it. Just use time(NULL).
- Tags:
- time
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2006 12:24 AM
08-09-2006 12:24 AM
Re: HP-UX shell or OE access to epoch secs
many thanks for all the efforts you took further elaborating on my somewhat idle query.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2006 12:19 PM
10-05-2006 12:19 PM
Re: HP-UX shell or OE access to epoch secs
function secsFromEpoch {
# Good until 2100
typeset -i year=0
typeset -i jDay=0
typeset -i hour=0
typeset -i min=0
typeset -i sec=0
typeset -i totalDays=0
typeset -i totalHours=0
typeset -i totalMinutes=0
typeset -i totalSeconds=0
date -u +"%Y %j %H %M %S" | read year jDay hour min sec
(( totalDays = ($year - 1970)*365 + ($year - 1968)/4 + $jDay - 1 ))
(( totalHours = $totalDays*24 + $hour ))
(( totalMinutes = $totalHours*60 + $min ))
(( totalSeconds = $totalMinutes*60 + $sec ))
echo $totalSeconds
- « Previous
-
- 1
- 2
- Next »