🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.sgi.graphics
2 messages
2 total messages Started by LANGER STEVEN C Fri, 22 Jan 1993 14:41
IRIX time
#115
Author: LANGER STEVEN C
Date: Fri, 22 Jan 1993 14:41
30 lines
1533 bytes
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"
 at the command line gives the correct
info. Why doesn't the code?

thanks in advance, steve



-- 
Steve Langer  			       sglanger@argo.acs.oakland.edu (VMS)
Oakland University		       sglanger@vela.acs.oakland.edu (Ultrix)
---------------------------------------------------------------------------
Standard disclaimers apply. In addition, the author makes no guarantees,
concerning the grammatical accuracy of his writing. Therefore, any ^B's, ^C's, 
midword character additions/deletions and other non-sense which occurs (after 
the work leaves the author's decade old text editor via his decade old Amiga, 
struggles through a local 1200 baud Merit server to be further mauled via the 
remote VAX mail servers) is someone elses problem - namely yours.
---------------------------------------------------------------------------
Re: IRIX time
#121
Author: Dave Olson
Date: Sat, 23 Jan 1993 19:40
29 lines
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads