home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!uwm.edu!ux1.cso.uiuc.edu!news.cecer.army.mil!pirzyk
- From: pirzyk@vinny.cecer.army.mil (Jim Pirzyk)
- Subject: Re: Need HELP with strptime....any answers/clues?????
- Message-ID: <BzH0Bs.K4J@news.cecer.army.mil>
- Sender: news@news.cecer.army.mil (Net.Noise owner)
- Organization: US Army Corps of Engineers Construction Engineering Research Labs
- References: <BzDJuA.AGF@sdf.lonestar.org>
- Date: Fri, 18 Dec 1992 19:47:52 GMT
- Lines: 54
-
- In <BzDJuA.AGF@sdf.lonestar.org> jjunker@sdf.lonestar.org (Jon Junker) writes:
-
- >Hi:
- >
- >I have been working with some of the time functions (on a Sun
- >SPARCstation IPX). After I make a call to strptime (to fill
- >in the tm structure) I display the structure (with dbxtool) and
- >find that the structure is filled in incorrectly. What am I
- >doing wrong?
- >
- >Please, e-mail me with the answer. Below is some example code.
- >
- >Thanks for your time,
- >Jon
- >jjunker@sdf.lonestar.org
- >
- >
- > ---------- Example Call to AsciiToTime ----------
- > :
- > :
- > :
- > timeStatus = AsciiToTime("1990,123/065301.123");
- > :
- > :
- > :
- >
- > ---------- Module and Call in Question ----------
-
- >#include <time.h>
- >
- >AsciiToTime(timeString)
- >char *timeString;
- >{
- > struct tm *my_tm;
- >
- > /* Convert time string into the time structure (my_tm) */
- > (void)strptime(timeString,"%Y,%j/%H%M%S",my_tm);
-
- strptime does not understand that the hour, minute, and second are only
- certain lengths. You need to have some other token to split the fields
- like a colon, or space.
-
- >
- >/* ---> After the above call to strptime the tm structure is not filled
- > in correctly. What am I doing wrong ??????
- >*/
- >
- > return(0);
- >}
- --
- [Jim] pirzyk@uiuc.edu ------------------------------------------
- TAC System Administrator, US Army Corps of Engineers
- Construction Engineering Research Labs, Champaign IL USA
- /* Contract employee, and do you think some federal paper pusher */
-