struct tm* time OVER HEAD question

This is a discussion on struct tm* time OVER HEAD question within the C++ Programming forums, part of the General Programming Boards category; I am trying to use the <ctime> struct *tm storage class. I am having problems with getting consistant results when ...

  1. #1
    Registered User
    Join Date
    May 2003
    Posts
    38

    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)

    -Chris

    Is there a better alternative to using this storage class?
    chris

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    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
    lyx
    lyx is offline
    Amateur
    Join Date
    Sep 2003
    Posts
    228
    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, 03: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, 09:24 AM
  5. Linked list, is this correct?
    By scrappy in forum C Programming
    Replies: 5
    Last Post: 11-12-2003, 11:06 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21