Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Aug 2000 20:18:07 +0100
From:      Mark Ovens <marko@freebsd.org>
To:        chat@freebsd.org
Subject:   C time functions - problem
Message-ID:  <20000808201807.H250@parish>

next in thread | raw e-mail | index | archive | help
Can anyone tell me why the call to localtime() in the code below
should segfault in tzset()?

Running it in the debugger shows that ``t'' is set to a sensible
value.

Program received signal SIGSEGV, Segmentation fault.
0x280be4c8 in tzset () from /usr/lib/libc.so.4


#include <stdio.h>
#include <time.h>
    
int main() {
    	struct tm *timeptr;
    	char buf[BUFSIZ];
    	size_t size;
    	time_t t;
      
    	tzset;
    
    	t = time((time_t *)0);
    	timeptr = localtime((time_t *)t);
    
	 .....



-- 
		4.4 - The number of the Beastie
________________________________________________________________
51.44°N  FreeBSD - The Power To Serve http://www.freebsd.org
2.057°W  My Webpage http://ukug.uk.freebsd.org/~mark
mailto:marko@freebsd.org                http://www.radan.com



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-chat" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000808201807.H250>