gettimeofday()

Discussion in 'OT Technology' started by BaZ, Jun 27, 2003.

  1. BaZ

    BaZ 2004 ACC Champions

    Joined:
    Jun 12, 2001
    Messages:
    2,005
    Likes Received:
    0
    Location:
    Hokieville, USA
    is there another system function that does the same thing as gettimeofday()? i came across an error in some code when i was porting something from solaris over to Linux & Windows

    edit: c or c++ function
     
  2. crotchfruit

    crotchfruit Guest

    :dunno:

    there's always localtime():

    start_time = time(0);
    struct tm* lt = localtime(&start_time);

    then you can reference lt->tm_mon, tm_year, tm_min, tm_hour, tm_sec, etc.
     
  3. BaZ

    BaZ 2004 ACC Champions

    Joined:
    Jun 12, 2001
    Messages:
    2,005
    Likes Received:
    0
    Location:
    Hokieville, USA
    i think i may have found something:

    struct timeval tv;
    tv.sec = (long)(clock());
     

Share This Page