By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,064 Members | 1,445 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,064 IT Pros & Developers. It's quick & easy.

current time

P: 1
If time( NULL ) pulls the date since Jan. 1, 1970, is there something that will pull the current system time?
Sep 16 '06 #1
Share this Question
Share on Google+
1 Reply


Banfa
Expert Mod 5K+
P: 8,916
That is the current system time, expressed as seconds since Jan 1 1970 (at midnight to fully qualify it).

You can get the date month year hours minutes seconds from this time by calling

gmtime or localtime returning respectively data for UTC (or GMT) or data for the local time zone.

both these function return struct tm *, this structure has the following members

tm_sec
Seconds after minute (0 59).

tm_min
Minutes after hour (0 59).

tm_hour
Hours since midnight (0 23).

tm_mday
Day of month (1 31).

tm_mon
Month (0 11; January = 0).

tm_year
Year (current year minus 1900).

tm_wday
Day of week (0 6; Sunday = 0).

tm_yday
Day of year (0 365; January 1 = 0).

tm_isdst
Always 0 for gmtime.
Sep 17 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.