mirror of
https://github.com/simh/simh.git
synced 2026-02-27 17:13:44 +00:00
TIMER: Add a generic time API to return the SCP time base
This commit is contained in:
11
sim_timer.c
11
sim_timer.c
@@ -2188,6 +2188,17 @@ sim_debug (DBG_GET, &sim_timer_dev, "sim_rtcn_get_time(tmr=%d)\n", tmr);
|
||||
clock_gettime (CLOCK_REALTIME, now);
|
||||
}
|
||||
|
||||
time_t sim_get_time (time_t *now)
|
||||
{
|
||||
struct timespec ts_now;
|
||||
|
||||
sim_debug (DBG_GET, &sim_timer_dev, "sim_get_time()\n");
|
||||
sim_rtcn_get_time (&ts_now, 0);
|
||||
if (now)
|
||||
*now = ts_now.tv_sec;
|
||||
return ts_now.tv_sec;
|
||||
}
|
||||
|
||||
/*
|
||||
* If the host system has a relatively large clock tick (as compared to
|
||||
* the desired simulated hz) ticks will naturally be scheduled late and
|
||||
|
||||
@@ -110,6 +110,7 @@ int32 sim_rtcn_init (int32 time, int32 tmr);
|
||||
int32 sim_rtcn_init_unit (UNIT *uptr, int32 time, int32 tmr);
|
||||
int32 sim_rtcn_init_unit_ticks (UNIT *uptr, int32 time, int32 tmr, int32 ticksper);
|
||||
void sim_rtcn_get_time (struct timespec *now, int tmr);
|
||||
time_t sim_get_time (time_t *now);
|
||||
t_stat sim_rtcn_tick_ack (uint32 time, int32 tmr);
|
||||
void sim_rtcn_init_all (void);
|
||||
int32 sim_rtcn_calb (uint32 ticksper, int32 tmr);
|
||||
|
||||
Reference in New Issue
Block a user