Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Sep 2001 14:56:55 +0200
From:      Gabriel Ambuehl <gabriel_ambuehl@buz.ch>
To:        questions@freebsd.org
Subject:   ctime() and friends broken?
Message-ID:  <152166323750.20010919145655@buz.ch>

next in thread | raw e-mail | index | archive | help
-----BEGIN PGP SIGNED MESSAGE-----

Hello,
I'm trying to either use ctime() or strftime() to convert an int
containing the seconds since the epoch to a human readable string,
but
so far, the only thing I get are segfaults:

#include <stdio.h>
#include <time.h>

int main()
{
        char timestr[40];
        ctime_r((time_t *) time(NULL), timestr);
        printf("Time: %s\n", timestr);
        return 0;
}

Will result in a segfault and nothing else. The same happens when
I try to feed the int to gmtime() so I could use the resulting struct
tm as input to strftime(). What am I doing wrong (4.4RC)?


Best regards,
 Gabriel
J

-----BEGIN PGP SIGNATURE-----
Version: PGP 6.5i

iQEVAwUBO6iICsZa2WpymlDxAQFdgAgAjnqUZSLdam2dJDOESXeRIaBOzbdN+6eK
ZR1jUlmUP81dfiN9xcuoJC8+Lxv2lA/MsaDo7dRJmKfo1GcdTx4rDouzl1zTHVWH
1i+AhNfXAnJMjhIIPWXF/dl90H0V3haMXcC0Bvjr/sr0O7kY2FP5FPfxVp1VVlo0
1IYK2CAu1t1UHAL/prF04xGB3Jr5jpWr3TfvZsK7HqZgTBkk0gfLCrNeGf4kLJtd
7+N4hX1aRMT6/JskkI0FD/UuXD0CIrQcv6PoMY+uTo3RLF8KkF7bFaSeU6x0SgnS
sICXqjAtW2NLToMg5mBywME9B2l6RUDOdSMZqZuaIBdbpI3jsBSbYg==
=6JIB
-----END PGP SIGNATURE-----


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




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