compat_gettimeofday.c revision 1.4
11.4Schristos/* $NetBSD: compat_gettimeofday.c,v 1.4 2013/10/04 21:07:37 christos Exp $ */ 21.2Schristos 31.2Schristos/*- 41.2Schristos * Copyright (c) 2008 The NetBSD Foundation, Inc. 51.2Schristos * All rights reserved. 61.2Schristos * 71.2Schristos * This code is derived from software contributed to The NetBSD Foundation 81.2Schristos * by Christos Zoulas. 91.2Schristos * 101.2Schristos * Redistribution and use in source and binary forms, with or without 111.2Schristos * modification, are permitted provided that the following conditions 121.2Schristos * are met: 131.2Schristos * 1. Redistributions of source code must retain the above copyright 141.2Schristos * notice, this list of conditions and the following disclaimer. 151.2Schristos * 2. Redistributions in binary form must reproduce the above copyright 161.2Schristos * notice, this list of conditions and the following disclaimer in the 171.2Schristos * documentation and/or other materials provided with the distribution. 181.2Schristos * 191.2Schristos * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 201.2Schristos * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 211.2Schristos * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 221.2Schristos * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 231.2Schristos * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 241.2Schristos * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 251.2Schristos * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 261.2Schristos * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 271.2Schristos * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 281.2Schristos * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 291.2Schristos * POSSIBILITY OF SUCH DAMAGE. 301.2Schristos */ 311.2Schristos 321.2Schristos#include <sys/cdefs.h> 331.2Schristos#if defined(LIBC_SCCS) && !defined(lint) 341.4Schristos__RCSID("$NetBSD: compat_gettimeofday.c,v 1.4 2013/10/04 21:07:37 christos Exp $"); 351.2Schristos#endif /* LIBC_SCCS and not lint */ 361.2Schristos 371.2Schristos#define __LIBC12_SOURCE__ 381.2Schristos 391.2Schristos#include "namespace.h" 401.2Schristos#include <sys/types.h> 411.2Schristos#include <sys/time.h> 421.2Schristos#include <compat/sys/time.h> 431.2Schristos 441.2Schristos__warn_references(gettimeofday, 451.2Schristos "warning: reference to compatibility gettimeofday(); include <sys/time.h> to generate correct reference") 461.2Schristos 471.4Schristos__strong_alias(gettimeofday, __compat_gettimeofday) 481.3Schristos 491.2Schristos/* 501.2Schristos * libc12 compatible gettimeofday routine. 511.2Schristos */ 521.2Schristosint 531.4Schristos__compat_gettimeofday(struct timeval50 *tv50, void *tzp) 541.2Schristos{ 551.2Schristos struct timeval tv; 561.2Schristos int rv; 571.2Schristos 581.2Schristos if ((rv = __gettimeofday50(&tv, tzp)) == -1) 591.2Schristos return rv; 601.2Schristos timeval_to_timeval50(&tv, tv50); 611.2Schristos return rv; 621.2Schristos} 63