Article View: comp.sys.sgi.graphics
Article #121Re: IRIX time
From: Dave Olson
Date: Sat, 23 Jan 1993 19:40
Date: Sat, 23 Jan 1993 19:40
29 lines
1515 bytes
1515 bytes
In <1993Jan22.144157.3002@vela.acs.oakland.edu> sglanger@vela.acs.oakland.edu (LANGER STEVEN C) writes:
| I'm using an Indigo with IRIX 4.0
|
| the code
| buf = ctime ((const time_t *) time);
| printf ("buf=%s\n", buf);
|
| always prints, no matter how often I call it, something like;
|
| Sat. Jan. 10, 1989 12:43:01
|
| (this may be the wrong order of data as I'm typeing this from
| memory). The point is, typeing "date"
As typed, the code is bogus. First, the variable 'time' will conflict
with the system call, probably giving link errors. Since you don't
show us how 'time' was initialized, we can't help you much more, but
it seems very likely that either it was never initialized, or done
incorrectly.
Something more like this is what you want:
time_t t;
time(&t); (or t = time(NULL);)
buf = ctime(&t);
--
Let no one tell me that silence gives consent, | Dave Olson
because whoever is silent dissents. | Silicon Graphics, Inc.
Maria Isabel Barreno | olson@sgi.com
Technical Details
Message-ID:
<v8cmdo4@zola.esd.sgi.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!olivea!spool.mu.edu!sgiblab!sgigate!odin!twilight!zola!anchor!olsonReferences:
<1993Jan22.144157.3002@vela.acs.oakland.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!olivea!spool.mu.edu!sgiblab!sgigate!odin!twilight!zola!anchor!olson From: olson@anchor.esd.sgi.com (Dave Olson) Newsgroups: comp.sys.sgi.graphics Subject: Re: IRIX time Message-ID: <v8cmdo4@zola.esd.sgi.com> Date: 23 Jan 93 19:40:11 GMT References: <1993Jan22.144157.3002@vela.acs.oakland.edu> Sender: news@zola.esd.sgi.com (Net News) Distribution: na Organization: Silicon Graphics, Inc. Mountain View, CA Lines: 29