Sponsored Content
Operating Systems Linux Red Hat How to check that a particular value is epoch seconds? Post 302809251 by Scrutinizer on Sunday 19th of May 2013 02:00:56 AM
Old 05-19-2013
And numbers larger than that if the epoch value refers to some point-in-time in the future..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Epoch

Hi all, i am trying to figure out how i can get a 'Nix box to display epoch time. Is there a command to do this? Do I know what I am talking about or am I an Idiot? Wait dont answer that last question!!!!! Thanx in advance!!!:confused: (2 Replies)
Discussion started by: Bodhi
2 Replies

2. Shell Programming and Scripting

check the file every 15 seconds

Hi All, I need a script which does, script check a file every 15 second, if file not exist, it will create a log file. how can I do it ? thanks Alice (4 Replies)
Discussion started by: alisevA3
4 Replies

3. Shell Programming and Scripting

Epoch time

Guys, i have a question... I have 2 sets of data say "a" and "a+1" which has values in epoch time.. Question is... if i were to get the time difference where diff = "a+1" - "a" can i convert it back to real time duration after the subtraction... OR i need to convert em first before i do the... (1 Reply)
Discussion started by: 12yearold
1 Replies

4. HP-UX

getting the "seconds since epoch" in HP-UX kernel

Hi! I'm writing a kernel module on HP-UX 11.23, and I can't find how to get the “number of seconds since epoch” (midnight of Jan 1st 1970). Actually I'm trying to find an equivalent to the user-space “time()” function... I found that in Linux, one can access “xtime.tv_sec” in the... (1 Reply)
Discussion started by: nati
1 Replies

5. Shell Programming and Scripting

shell script that will automatically check if specifed user is log in or not, in 30 seconds

guys I need emergency help with below shell script assignment..am new to shell script Write a Shell script to automatically check that a specified user is logged in to the computer. The program should allow the person running the script to specify the name of the user to be checked, the... (2 Replies)
Discussion started by: gurmad
2 Replies

6. Shell Programming and Scripting

Date conversion from Standard/given format to seconds/epoch

I am trying get time difference of two dates in secs. Initially I want to convert a standard date format to epoch for two dates and then subtract the two epoch dates. Example : date -d "2007-09-01 17:30:40" '+%s' But this gives me below error date: illegal option -- d Usage: date OS: AIX... (6 Replies)
Discussion started by: bpaac
6 Replies

7. Shell Programming and Scripting

Adding Seconds to UNIX/Epoch-Time

Hello All, I have a Perl script I'm writing where I ask the user to enter a "start time" for something. The "$start_time" will be in the format of: # The Time CLI Option Can be in the format of: --start-time="1day" --start-time="2hours" --start-time="45min" ... (1 Reply)
Discussion started by: mrm5102
1 Replies

8. Shell Programming and Scripting

Current triggered time to epoch seconds

I have a requirement to find long running instances for notifying the stake holders based on the triggered time in AIX. I am not sure how to convert the triggered time to epoch seconds. For example : Current triggered time of instance is 13:06:19 -> how to convert this into epoch in the... (5 Replies)
Discussion started by: chandu123
5 Replies

9. UNIX for Dummies Questions & Answers

Condition based on Timestamp (Date/Time based) from logfile (Epoch seconds)

Below is the sample logfile: Userids Date Time acb Checkout time: 2013-11-20 17:00 axy Checkout time: 2013-11-22 12:00 der Checkout time: 2013-11-17 17:00 xyz Checkout time: 2013-11-19 16:00 ddd Checkout time: 2013-11-21 16:00 aaa Checkout... (9 Replies)
Discussion started by: asjaiswal
9 Replies

10. Shell Programming and Scripting

Convert a future date into epoch seconds on HPUX system

Hi All, I have scenario where i have to compare two dates. I thought of converting them to epoch seconds and do a numeric comparison. This works fine on Linux systems. $ date -d '2015/12/31' +%s 1451538000 $ date +%s 1449159121 But we don't have -d option in HPUX. What would be... (5 Replies)
Discussion started by: veeresh_15
5 Replies
Test::MockTime(3pm)					User Contributed Perl Documentation				       Test::MockTime(3pm)

NAME
Test::MockTime - Replaces actual time with simulated time SYNOPSIS
use Test::MockTime qw( :all ); set_relative_time(-600); # do some tests depending on time increasing from 600 seconds ago set_absolute_time(0); # do some more tests depending on time starting from the epoch # epoch may vary according to platform. see perlport. set_fixed_time(CORE::time()); # do some more tests depending on time staying at the current actual time set_absolute_time('1970-01-01T00:00:00Z'); # do some tests depending on time starting at Unix epoch time set_fixed_time('01/01/1970 00:00:00', '%m/%d/%Y %H:%M:%S'); # do some tests depending on time staying at the Unix epoch time restore_time(); # resume normal service DESCRIPTION
This module was created to enable test suites to test code at specific points in time. Specifically it overrides localtime, gmtime and time at compile time and then relies on the user supplying a mock time via set_relative_time, set_absolute_time or set_fixed_time to alter future calls to gmtime,time or localtime. Functions set_absolute_time If given a single, numeric argument, the argument is an absolute time (for example, if 0 is supplied, the absolute time will be the epoch), and calculates the offset to allow subsequent calls to time, gmtime and localtime to reflect this. for example, in the following code Time::Mock::set_absolute_time(0); my ($start) = time; sleep 2; my ($end) = time; The $end variable should contain 2 seconds past the epoch; If given two arguments, the first argument is taken to be an absolute time in some string format (for example, "01/01/1970 00:00:00"). The second argument is taken to be a "strptime" format string (for example, "%m/%d/%Y %H:%M:%S"). If a single argument is given, but that argument is not numeric, a "strptime" format string of "%Y-%m-%dT%H:%M:%SZ" is assumed. for example, in the following code Time::Mock::set_absolute_time('1970-01-01T00:00:00Z'); my ($start) = time; sleep 2; my ($end) = time; The $end variable should contain 2 seconds past the Unix epoch; set_relative_time($relative) takes as an argument an relative value from current time (for example, if -10 is supplied, current time be converted to actual machine time - 10 seconds) and calculates the offset to allow subsequent calls to time,gmtime and localtime to reflect this. for example, in the following code my ($start) = time; Time::Mock::set_relative_time(-600); sleep 600; my ($end) = time; The $end variable should contain either the same or very similar values to the $start variable. set_fixed_time If given a single, numeric argument, the argument is an absolute time (for example, if 0 is supplied, the absolute time will be the epoch). All subsequent calls to gmtime, localtime and time will return this value. for example, in the following code Time::Mock::set_fixed_time(time) my ($start) = time; sleep 3; my ($end) = time; the $end variable and the $start variable will contain the same results If given two arguments, the first argument is taken to be an absolute time in some string format (for example, "01/01/1970 00:00:00"). The second argument is taken to be a "strptime" format string (for example, "%m/%d/%Y %H:%M:%S"). If a single argument is given, but that argument is not numeric, a "strptime" format string of "%Y-%m-%dT%H:%M:%SZ" is assumed. restore() restore the default time handling values. "restore_time" is an alias. When exported with the 'all' tag, this subroutine is exported as "restore_time". AUTHOR
David Dick <ddick@cpan.org> PREREQUISITES
Time::Piece 1.08 or greater BUGS
Probably. COPYRIGHT
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. ACKNOWLEDGEMENTS
Thanks to a use.perl.org journal entry <http://use.perl.org/~geoff/journal/20660> by Geoffrey Young. perl v5.10.0 2008-06-29 Test::MockTime(3pm)
All times are GMT -4. The time now is 03:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy