localtime_r.c revision 102644
1124196Sbms/*
2164124Sbms * Copyright (c) 2000 Kungliga Tekniska H�gskolan
3124196Sbms * (Royal Institute of Technology, Stockholm, Sweden).
4124196Sbms * All rights reserved.
5124196Sbms *
6124196Sbms * Redistribution and use in source and binary forms, with or without
7124196Sbms * modification, are permitted provided that the following conditions
8124196Sbms * are met:
9124196Sbms *
10124196Sbms * 1. Redistributions of source code must retain the above copyright
11124196Sbms *    notice, this list of conditions and the following disclaimer.
12124196Sbms *
13165935Simp * 2. Redistributions in binary form must reproduce the above copyright
14124196Sbms *    notice, this list of conditions and the following disclaimer in the
15124196Sbms *    documentation and/or other materials provided with the distribution.
16124196Sbms *
17124196Sbms * 3. Neither the name of the Institute nor the names of its contributors
18124196Sbms *    may be used to endorse or promote products derived from this software
19124196Sbms *    without specific prior written permission.
20124196Sbms *
21124196Sbms * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
22124196Sbms * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23124196Sbms * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24124196Sbms * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
25124196Sbms * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26124196Sbms * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27124196Sbms * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28124196Sbms * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29124196Sbms * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30124196Sbms * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31124196Sbms * SUCH DAMAGE.
32124196Sbms */
33124196Sbms
34124196Sbms#ifdef HAVE_CONFIG_H
35124196Sbms#include <config.h>
36124196SbmsRCSID("$Id: localtime_r.c,v 1.2 2002/08/20 13:00:35 joda Exp $");
37124196Sbms#endif
38124196Sbms
39124196Sbms#include <stdio.h>
40124196Sbms#include <time.h>
41124196Sbms#include "roken.h"
42124196Sbms
43124196Sbms#ifndef HAVE_LOCALTIME_R
44124196Sbms
45124196Sbmsstruct tm *
46124196Sbmslocaltime_r(const time_t *timer, struct tm *result)
47124196Sbms{
48124196Sbms    struct tm *tm;
49124196Sbms
50124196Sbms    tm = localtime((time_t *)timer);
51124196Sbms    if (tm == NULL)
52124196Sbms	return NULL;
53124196Sbms    *result = *tm;
54124196Sbms    return result;
55124196Sbms}
56164123Sbms
57164123Sbms#endif
58164123Sbms