2007-04-27 12:17:22 +00:00
|
|
|
/*
|
2009-06-12 09:31:25 +00:00
|
|
|
* Copyright 2009, Axel Dörfler, axeld@pinc-software.de.
|
2007-04-27 12:17:22 +00:00
|
|
|
* Copyright 2007, Ingo Weinhold, bonefish@cs.tu-berlin.de.
|
2009-06-12 09:31:25 +00:00
|
|
|
*
|
2007-04-27 12:17:22 +00:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
|
2007-04-30 17:19:19 +00:00
|
|
|
#include "compatibility.h"
|
2007-04-27 12:17:22 +00:00
|
|
|
|
|
|
|
#include "fssh_os.h"
|
|
|
|
#include "fssh_time.h"
|
|
|
|
|
|
|
|
#include <time.h>
|
2009-06-12 09:31:25 +00:00
|
|
|
#include <sys/time.h>
|
2007-04-27 12:17:22 +00:00
|
|
|
|
|
|
|
#include <OS.h>
|
|
|
|
|
|
|
|
|
|
|
|
// #pragma mark - OS.h
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
2009-06-12 09:31:25 +00:00
|
|
|
void
|
|
|
|
fssh_set_real_time_clock(uint32_t secs_since_jan1_1970)
|
2007-04-27 12:17:22 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-06-12 09:31:25 +00:00
|
|
|
fssh_status_t
|
|
|
|
fssh_set_timezone(char *timezone)
|
2007-04-27 12:17:22 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2009-06-12 09:31:25 +00:00
|
|
|
#endif // 0
|
2007-04-27 12:17:22 +00:00
|
|
|
|
2009-06-12 09:31:25 +00:00
|
|
|
uint32_t
|
|
|
|
fssh_real_time_clock(void)
|
2007-04-27 12:17:22 +00:00
|
|
|
{
|
2009-06-12 09:31:25 +00:00
|
|
|
timeval tv;
|
|
|
|
gettimeofday(&tv, NULL);
|
|
|
|
|
|
|
|
return tv.tv_sec;
|
2007-04-27 12:17:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-06-12 09:31:25 +00:00
|
|
|
fssh_bigtime_t
|
|
|
|
fssh_real_time_clock_usecs(void)
|
2007-04-27 12:17:22 +00:00
|
|
|
{
|
2009-06-12 09:31:25 +00:00
|
|
|
timeval tv;
|
|
|
|
gettimeofday(&tv, NULL);
|
|
|
|
|
|
|
|
return tv.tv_sec * 1000000LL + tv.tv_usec;
|
2007-04-27 12:17:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fssh_bigtime_t
|
|
|
|
fssh_system_time(void)
|
|
|
|
{
|
|
|
|
return system_time();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// #pragma mark - time.h
|
|
|
|
|
|
|
|
|
|
|
|
fssh_time_t
|
|
|
|
fssh_time(fssh_time_t *timer)
|
|
|
|
{
|
|
|
|
time_t result = time(NULL);
|
|
|
|
if (timer)
|
|
|
|
*timer = result;
|
|
|
|
return result;
|
|
|
|
}
|