- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Timestamp
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
Forums
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
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
09-13-2001 02:55 AM
09-13-2001 02:55 AM
For example
timestamp 9800370710
generated from 2000-Dec-18 14:20:34
I want to get a timestamp for current date/time in order for comparasion of job execution time.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2001 03:11 AM
09-13-2001 03:11 AM
Solution#include
#include
main()
{
time_t t;
time(&t);
printf("%d", t);
}
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2001 04:14 AM
09-13-2001 04:14 AM
Re: Timestamp
To get the current timestamp:
perl -e 'print time,"\n"'
Rgds, Robin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2001 05:45 AM
09-13-2001 05:45 AM
Re: Timestamp
If you needed improved accuracy (clock ticks vs. seconds) use the gettimeofday function replacing the time function in the C-program.
Klaus
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2001 05:32 PM
09-13-2001 05:32 PM
Re: Timestamp
Sorry, I am afraid I have misleaded you.
I want to compare different finish time of jobs so "timex" command cannot be used.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2001 05:47 PM
09-13-2001 05:47 PM
Re: Timestamp
- Use gnu date with the %s formatting option
date +%s
- Use perl like Robin suggested
perl -e 'print time();'
- Use a simple program such as Sridhar presented.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2001 06:08 PM
09-13-2001 06:08 PM
Re: Timestamp
The first option doesn't work.
# date +%s
date: bad format character - s
# date +"%s"
date: bad format character - s
It works using perl or writing a C program so I will not try Sridhar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2001 06:35 PM
09-13-2001 06:35 PM
Re: Timestamp
we use.
#date +%m%d%H%M
Gives you
09132138
From Thu Sep 13 21:38:13 CDT 2001
In a job redirect your output to file.txt
With this at the end
stamp=`date +%m%d%H%M`
cp file.txt file.txt.$stamp
and it will look like this
file.txt.09132138
Richard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2001 06:40 PM
09-13-2001 06:40 PM
Re: Timestamp
#date +%m%d%H%M%S
Gives you
0913214619
from ..
Thu Sep 13 21:46:19 CDT 2001
Richard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2001 08:05 PM
09-13-2001 08:05 PM
Re: Timestamp
I have thunk of your idea but I find that it does not suit my need.
The reason is that I can't find the difference of time between two timestamp made from date +%m%d%H%M%S.
If using other method to obtain the timestamp, I can get the difference of seconds.