home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / c / 18645 < prev    next >
Encoding:
Text File  |  1992-12-21  |  1.9 KB  |  66 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!uwm.edu!ux1.cso.uiuc.edu!news.cecer.army.mil!pirzyk
  3. From: pirzyk@vinny.cecer.army.mil (Jim Pirzyk)
  4. Subject: Re: Need HELP with strptime....any answers/clues?????
  5. Message-ID: <BzH0Bs.K4J@news.cecer.army.mil>
  6. Sender: news@news.cecer.army.mil (Net.Noise owner)
  7. Organization: US Army Corps of Engineers Construction Engineering Research Labs
  8. References: <BzDJuA.AGF@sdf.lonestar.org>
  9. Date: Fri, 18 Dec 1992 19:47:52 GMT
  10. Lines: 54
  11.  
  12. In <BzDJuA.AGF@sdf.lonestar.org> jjunker@sdf.lonestar.org (Jon Junker) writes:
  13.  
  14. >Hi:
  15. >I have been working with some of the time functions (on a Sun
  16. >SPARCstation IPX).  After I make a call to strptime (to fill 
  17. >in the tm structure) I display the structure (with dbxtool) and
  18. >find that the structure is filled in incorrectly.  What am I 
  19. >doing wrong?
  20. >Please, e-mail me with the answer. Below is some example code.
  21. >Thanks for your time,
  22. >Jon
  23. >jjunker@sdf.lonestar.org
  24. >        ---------- Example Call to AsciiToTime ----------
  25. >                :
  26. >                :
  27. >                :
  28. >    timeStatus = AsciiToTime("1990,123/065301.123");
  29. >                :
  30. >                :
  31. >                :
  32. >        ---------- Module and Call in Question ----------
  33.  
  34. >#include    <time.h>
  35. >AsciiToTime(timeString)
  36. >char    *timeString;
  37. >{
  38. >    struct    tm    *my_tm;
  39. >    /* Convert time string into the time structure (my_tm) */
  40. >    (void)strptime(timeString,"%Y,%j/%H%M%S",my_tm);
  41.  
  42. strptime does not understand that the hour, minute, and second are only
  43. certain lengths.  You need to have some other token to split the fields
  44. like a colon, or space.
  45.  
  46. >/* ---> After the above call to strptime the tm structure is not filled
  47. >    in correctly. What am I doing wrong ??????
  48. >*/
  49. >    return(0);
  50. >}
  51. -- 
  52. [Jim] pirzyk@uiuc.edu ------------------------------------------
  53. TAC System Administrator, US Army Corps of Engineers 
  54. Construction Engineering Research Labs, Champaign IL USA
  55. /* Contract employee, and do you think some federal paper pusher */
  56.