mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-10-14 13:15:21 +08:00
Update due to API changes (timecounters)
This commit is contained in:
@@ -32,21 +32,21 @@
|
||||
#define _RTEMS_BSD_SYS_TIME_H_
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <rtems.h>
|
||||
#include <rtems/timecounter.h>
|
||||
|
||||
static inline time_t
|
||||
rtems_bsd_time_second(void)
|
||||
{
|
||||
return time(NULL);
|
||||
}
|
||||
|
||||
static inline time_t
|
||||
rtems_bsd_time_uptime(void)
|
||||
{
|
||||
return rtems_clock_get_uptime_seconds();
|
||||
}
|
||||
|
||||
#define time_second rtems_bsd_time_second()
|
||||
#define time_uptime rtems_bsd_time_uptime()
|
||||
#define bintime(_x) _Timecounter_Bintime(_x)
|
||||
#define nanotime(_x) _Timecounter_Nanotime(_x)
|
||||
#define microtime(_x) _Timecounter_Microtime(_x)
|
||||
#define binuptime(_x) _Timecounter_Binuptime(_x)
|
||||
#define nanouptime(_x) _Timecounter_Nanouptime(_x)
|
||||
#define microuptime(_x) _Timecounter_Microuptime(_x)
|
||||
#define getbintime(_x) _Timecounter_Getbintime(_x)
|
||||
#define getnanotime(_x) _Timecounter_Getnanotime(_x)
|
||||
#define getmicrotime(_x) _Timecounter_Getmicrotime(_x)
|
||||
#define getbinuptime(_x) _Timecounter_Getbinuptime(_x)
|
||||
#define getnanouptime(_x) _Timecounter_Getnanouptime(_x)
|
||||
#define getmicrouptime(_x) _Timecounter_Getmicrouptime(_x)
|
||||
#define time_second _Timecounter_Time_second
|
||||
#define time_uptime _Timecounter_Time_uptime
|
||||
|
||||
#endif /* _RTEMS_BSD_SYS_TIME_H_ */
|
||||
|
@@ -71,9 +71,6 @@ int hz;
|
||||
int tick;
|
||||
int maxusers; /* base tunable */
|
||||
|
||||
struct bintime boottimebin;
|
||||
struct timeval boottime;
|
||||
|
||||
static SYSCTL_NODE(_kern, OID_AUTO, smp, CTLFLAG_RD|CTLFLAG_CAPRD, NULL,
|
||||
"Kernel SMP");
|
||||
|
||||
@@ -103,9 +100,6 @@ rtems_bsd_initialize(void)
|
||||
maxusers = 1;
|
||||
maxid_maxcpus = (int) rtems_get_processor_count();
|
||||
|
||||
gettimeofday(&boottime, NULL);
|
||||
timeval2bintime(&boottime, &boottimebin);
|
||||
|
||||
mkdir("/etc", S_IRWXU | S_IRWXG | S_IRWXO);
|
||||
|
||||
sc = rtems_timer_initiate_server(
|
||||
|
@@ -52,45 +52,3 @@ tvtohz(struct timeval *tv)
|
||||
|
||||
return (int) _Timespec_To_ticks( &ts );
|
||||
}
|
||||
|
||||
void
|
||||
binuptime(struct bintime *bt)
|
||||
{
|
||||
struct timeval tv;
|
||||
|
||||
rtems_clock_get_uptime_timeval(&tv);
|
||||
timeval2bintime(&tv, bt);
|
||||
}
|
||||
|
||||
void
|
||||
bintime(struct bintime *bt)
|
||||
{
|
||||
struct timeval tv;
|
||||
|
||||
gettimeofday(&tv, NULL);
|
||||
timeval2bintime(&tv, bt);
|
||||
}
|
||||
|
||||
void
|
||||
microtime(struct timeval *tvp)
|
||||
{
|
||||
gettimeofday(tvp, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
getbinuptime(struct bintime *bt)
|
||||
{
|
||||
binuptime(bt);
|
||||
}
|
||||
|
||||
void
|
||||
getmicrouptime(struct timeval *tvp)
|
||||
{
|
||||
rtems_clock_get_uptime_timeval(tvp);
|
||||
}
|
||||
|
||||
void
|
||||
getmicrotime(struct timeval *tvp)
|
||||
{
|
||||
microtime(tvp);
|
||||
}
|
||||
|
Reference in New Issue
Block a user