current time

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mag142
    New Member
    • Sep 2006
    • 1

    #1

    current time

    If time( NULL ) pulls the date since Jan. 1, 1970, is there something that will pull the current system time?
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    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.

    Comment

    Working...