Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

time(2) [redhat man page]

TIME(2) 						     Linux Programmer's Manual							   TIME(2)

NAME
time - get time in seconds SYNOPSIS
#include <time.h> time_t time(time_t *t); DESCRIPTION
time returns the time since the Epoch (00:00:00 UTC, January 1, 1970), measured in seconds. If t is non-NULL, the return value is also stored in the memory pointed to by t. RETURN VALUE
On success, the value of time in seconds since the Epoch is returned. On error, ((time_t)-1) is returned, and errno is set appropriately. ERRORS
EFAULT t points outside your accessible address space. NOTES
POSIX.1 defines seconds since the Epoch as a value to be interpreted as the number of seconds between a specified time and the Epoch, according to a formula for conversion from UTC equivalent to conversion on the naive basis that leap seconds are ignored and all years divisible by 4 are leap years. This value is not the same as the actual number of seconds between the time and the Epoch, because of leap seconds and because clocks are not required to be synchronised to a standard reference. The intention is that the interpretation of sec- onds since the Epoch values be consistent; see POSIX.1 Annex B 2.2.2 for further rationale. CONFORMING TO
SVr4, SVID, POSIX, X/OPEN, BSD 4.3 Under BSD 4.3, this call is obsoleted by gettimeofday(2). POSIX does not specify any error conditions. SEE ALSO
ctime(3), date(1), ftime(3), gettimeofday(2) Linux 2.0.30 1997-09-09 TIME(2)

Check Out this Related Man Page

TIME(2) 						     Linux Programmer's Manual							   TIME(2)

NAME
time - get time in seconds SYNOPSIS
#include <time.h> time_t time(time_t *t); DESCRIPTION
time() returns the time as the number of seconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC). If t is non-NULL, the return value is also stored in the memory pointed to by t. RETURN VALUE
On success, the value of time in seconds since the Epoch is returned. On error, ((time_t) -1) is returned, and errno is set appropriately. ERRORS
EFAULT t points outside your accessible address space. CONFORMING TO
SVr4, 4.3BSD, C89, C99, POSIX.1-2001. POSIX does not specify any error conditions. NOTES
POSIX.1 defines seconds since the Epoch using a formula that approximates the number of seconds between a specified time and the Epoch. This formula takes account of the facts that all years that are evenly divisible by 4 are leap years, but years that are evenly divisible by 100 are not leap years unless they are also evenly divisible by 400, in which case they are leap years. This value is not the same as the actual number of seconds between the time and the Epoch, because of leap seconds and because system clocks are not required to be syn- chronized to a standard reference. The intention is that the interpretation of seconds since the Epoch values be consistent; see POSIX.1-2008 Rationale A.4.15 for further rationale. SEE ALSO
date(1), gettimeofday(2), ctime(3), ftime(3), time(7) COLOPHON
This page is part of release 3.53 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2011-09-09 TIME(2)
Man Page

15 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Regarding time

Hi, How can I print the time in seconds(only). I have get the execution time of a script. Now I want the duration in seconds. How can I do it? Thanks in advance (4 Replies)
Discussion started by: sendhilmani
4 Replies

2. SCO

Network lost after reboot

Hi .. can anyone help with this pleeaasse .. I have a Sco Unixware 7.1.0 server which has been running fine for nearly 10 years ... we have not had to do any os changes for several years. We tend to reboot it about once a month just to keep everthing clean! My issue is that we have just... (7 Replies)
Discussion started by: DickTutton
7 Replies

3. UNIX for Dummies Questions & Answers

Unix Command to separate this years files and last years?

Hello - I have a folder that contains files from 2003 till 2010. I am trying to figure out a command that would seperate each years file and show me a count? Even if i can find a command that would give me year by year count, thats good enough too. Thanks (8 Replies)
Discussion started by: DallasT
8 Replies

4. What is on Your Mind?

STILL can't buy a Linux PC easily

A few years ago, Dell announced they were selling PCs with Linux (Ubuntu) preinstalled or with no OS installed. It was about time! So a couple years ago I bought the Inspiron 1525n laptop that I'm typing this on with Ubuntu preinstalled. Yea! (Though I immediately wiped Ubuntu and installed... (7 Replies)
Discussion started by: KenJackson
7 Replies

5. AIX

AIX TIME CHANGE

Hi Guys , I see a weird problem with one of the AIX Machine, The time is changing randomly on the server. The seconds part of the time is what is the problem which is jumping on a uneven order and coming back to the original state after some time and again the same.. I have collected the time... (8 Replies)
Discussion started by: kkeng808
8 Replies

6. Shell Programming and Scripting

Shell Script for Epoch Time Conversion

Hi there I came across this script online to convert Epoch time to proper date format, but I am receiving the following error Also, I have HISTTIMEFORMAT set in user's .profile so that their history output shows time stamps. Additionally I have changed their .history location to a dedicated... (9 Replies)
Discussion started by: hedkandi
9 Replies

7. What is on Your Mind?

I'm back

Hi all, I used to post here years ago, and was a moderator, my old username: zazzybob. Anyway, after a few years away focusing on my career, I'm back and keener than ever to get involved in the unix.com community again. I'm looking forward to getting back into the swing of things, helping... (11 Replies)
Discussion started by: tokiwinter
11 Replies

8. Shell Programming and Scripting

If then logic with TIME

Hi all, Can anyone suggest how to formulate the if/then when TIME equals a certain time, in this case 23:55:00 export TIME=`date +%T` function tnsrec { if $TIME = 23:55:00; then otherfunction else exit fi } Thanks in advance. jd (6 Replies)
Discussion started by: jonnyd
6 Replies

9. Shell Programming and Scripting

What does this mean?

Hello all, I am a newbie in shell scripting. I want to know what does the below text means? 6.355u 1.679s 0:12.68 63.2% 0+0k 0+0io 0pf+0w I am getting this line (on terminal) after every successful execution of my script. Thanks in advance . . :) -MD (15 Replies)
Discussion started by: manands07
15 Replies

10. Programming

How to contribute Linux in Development?

Hello, I am a Linux/Unix System Administrator as a profession from last 8 years and now want to jump into Linux programming to contribute something to this in which i spent these many years for its integration/Administration/Configuration/Servers Setups. Please let me know i can start working... (5 Replies)
Discussion started by: sunnysthakur
5 Replies

11. Shell Programming and Scripting

Change the seconds value in date column

Hello, I have a file with below contents and need to set seconds value to 00 (as you can see few time stamps are with 01 seconds) 18:16:00 8192 7301 89 11 18:21:00 8192 7305 89 11 18:26:00 8192 7306 89 11 18:31:00 8192 7306 ... (6 Replies)
Discussion started by: reddyr
6 Replies

12. Shell Programming and Scripting

sed the with same value

hello, I would like to make a sed to get from this file: T1 TIME(3), T2 TIME(5), T3 TIME(2) WITH TIME ZONE, And obtain: T1 TIME(3) WITH TIME ZONE, T2 TIME(5) WITH TIME ZONE, T3 TIME(2) WITH TIME ZONE In fact I tried this command : sed "s/TIME(),/TIME() WITH TIME ZONE,/g" But I... (4 Replies)
Discussion started by: CodeurNormand
4 Replies

13. UNIX for Dummies Questions & Answers

Convert Epoch to timestamp in a file

Hi Team, Could you please let me know ,how to convert Epoch column to timestamp in a flat file. "57894"|"1454247163111"|"""HH""" "57897"|"1454247163111"|"""HH""" "7906"|"1454247163111"|"""ss""" I want second field as timestamp. This thread has been moved from a non-technical forum to... (6 Replies)
Discussion started by: shabeena
6 Replies

14. Shell Programming and Scripting

Duration Calculation

I have 2 variables startTime='122717 23:20' endTime='122817 0:40' how can i get the elapsed duration as like "1 hour 20 minutes" ? (8 Replies)
Discussion started by: vikram3.r
8 Replies

15. What is on Your Mind?

I'll probably never be the best in the field...

I don't know how to start this but here goes. I've been "using" Linux for over 10 years, possibly more and I still feel like I'm nowhere where I should be. I'll be fair most of my time was spent either figuring out how to run games on *nix at the time but as I got older and "wiser" I... (8 Replies)
Discussion started by: samthewildone
8 Replies