2014-05-02 18:04:34 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2013 Oliver Hahm <oliver.hahm@inria.fr>
|
|
|
|
*
|
2014-07-31 19:59:02 +02:00
|
|
|
* This file is subject to the terms and conditions of the GNU Lesser
|
|
|
|
* General Public License v2.1. See the file LICENSE in the top level
|
|
|
|
* directory for more details.
|
2014-05-02 18:04:34 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* @ingroup arm_common
|
|
|
|
* @brief LPC2387 Newlib gettimeofday() system call glue
|
|
|
|
*
|
|
|
|
* @author Michael Baar <michael.baar@fu-berlin.de>
|
|
|
|
* @author René Kijewski <rene.kijewski@fu-berlin.de>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/time.h>
|
2014-07-06 22:57:56 +02:00
|
|
|
#include "kernel_types.h"
|
2014-05-02 18:04:34 +02:00
|
|
|
|
|
|
|
#if defined MODULE_RTC
|
|
|
|
# include "rtc.h"
|
|
|
|
#elif defined MODULE_VTIMER
|
|
|
|
# include "vtimer.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Declared as external, without a definition. */
|
|
|
|
/* This will cause a linktime error, if _gettimeofday() is referenced, */
|
|
|
|
/* and neither rtc nor vtimer were linked in. */
|
|
|
|
extern void __gettimeofday_syscall_is_not_implemented_without_vtimer_or_rtc_module(void);
|
|
|
|
|
|
|
|
int _gettimeofday(struct timeval *tp, void *restrict tzp)
|
|
|
|
{
|
|
|
|
(void) tzp;
|
|
|
|
|
|
|
|
#if defined MODULE_RTC
|
|
|
|
rtc_time(tp);
|
|
|
|
#elif defined MODULE_VTIMER
|
|
|
|
vtimer_gettimeofday(tp);
|
|
|
|
#else
|
2014-08-01 10:12:33 +02:00
|
|
|
(void) tp;
|
2014-05-02 18:04:34 +02:00
|
|
|
__gettimeofday_syscall_is_not_implemented_without_vtimer_or_rtc_module();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|