Thread: struct tm* time OVER HEAD question

  1. #1
    Registered User
    Join Date
    May 2003

    struct tm* time OVER HEAD question

    I am trying to use the <ctime> struct *tm storage class. I am having problems with getting consistant results when accessing the members of the struct. When printing out the time in a loop, I get 0's 75% of the time (i rarely get the stored time). The behavior is somewhat bizzard because in other location in my software I conistanly get the correct results. So my question is, Is there a lot of overhead in using this *tm struct, and could this be causing my problems or do "you" think my problem lies some where else.

    (I noticed that if I put a Sleep(x) in front of where I am access the time elements I get better results..but still not 100% which is what I need)


    Is there a better alternative to using this storage class?

  2. #2
    Registered User
    Join Date
    Oct 2001
    Are you using the function localtime() to return the struct *tm? There's nothing I can think of which would cause this to occur. Maybe you could post a code snippet.

  3. #3
    Join Date
    Sep 2003
    I don't think the problem lies here, I tried a 10000-time loop which only get the time and displays it and nothing strange appeared.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can't figure out problem with code
    By Beast() in forum C Programming
    Replies: 4
    Last Post: 04-16-2005, 05:27 PM
  2. linked list problem
    By kzar in forum C Programming
    Replies: 8
    Last Post: 02-05-2005, 04:16 PM
  3. towers of hanoi problem
    By aik_21 in forum C Programming
    Replies: 1
    Last Post: 10-02-2004, 01:34 PM
  4. Bi-Directional Linked Lists
    By Thantos in forum C Programming
    Replies: 6
    Last Post: 12-11-2003, 10:24 AM
  5. Linked list, is this correct?
    By scrappy in forum C Programming
    Replies: 5
    Last Post: 11-13-2003, 12:06 AM