home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / sys / sgi / graphics / 190 < prev    next >
Encoding:
Internet Message Format  |  1993-01-24  |  1.4 KB

  1. Path: sparky!uunet!olivea!spool.mu.edu!sgiblab!sgigate!odin!twilight!zola!anchor!olson
  2. From: olson@anchor.esd.sgi.com (Dave Olson)
  3. Newsgroups: comp.sys.sgi.graphics
  4. Subject: Re: IRIX time
  5. Message-ID: <v8cmdo4@zola.esd.sgi.com>
  6. Date: 23 Jan 93 19:40:11 GMT
  7. References: <1993Jan22.144157.3002@vela.acs.oakland.edu>
  8. Sender: news@zola.esd.sgi.com (Net News)
  9. Distribution: na
  10. Organization: Silicon Graphics, Inc.  Mountain View, CA
  11. Lines: 29
  12.  
  13. In <1993Jan22.144157.3002@vela.acs.oakland.edu> sglanger@vela.acs.oakland.edu (LANGER STEVEN C) writes:
  14.  
  15. | I'm using an Indigo with IRIX 4.0
  16. | the code
  17. |         buf = ctime ((const time_t *) time);
  18. |         printf ("buf=%s\n", buf);
  19. | always prints, no matter how often I call it, something like;
  20. |     Sat. Jan. 10, 1989 12:43:01
  21. | (this may be the wrong order of data as I'm typeing this from 
  22. | memory). The point is, typeing "date"
  23.  
  24. As typed, the code is bogus.  First, the variable 'time' will conflict
  25. with the system call, probably giving link errors.  Since you don't
  26. show us how 'time' was initialized, we can't help you much more, but
  27. it seems very likely that either it was never initialized, or done
  28. incorrectly.
  29.  
  30. Something more like this is what you want:
  31.     time_t t;
  32.     time(&t); (or t = time(NULL);)
  33.     buf = ctime(&t);
  34. --
  35. Let no one tell me that silence gives consent,  |   Dave Olson
  36. because whoever is silent dissents.             |   Silicon Graphics, Inc.
  37.     Maria Isabel Barreno                        |   olson@sgi.com
  38.