diff --git a/sim_timer.c b/sim_timer.c index 7754d3f0..990cac99 100644 --- a/sim_timer.c +++ b/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 diff --git a/sim_timer.h b/sim_timer.h index cf537718..6f811fcf 100644 --- a/sim_timer.h +++ b/sim_timer.h @@ -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);