pwr_tDeltaTime * time_Uptime ( pwr_tStatus *status, pwr_tDeltaTime *tp, pwr_tDeltaTime *ap ) { pwr_tDeltaTime time; long tics; void *argv[2]; pwr_dStatus(sts, status, TIME__SUCCESS); if (tp == NULL) tp = &time; argv[0] = (void *) 1; argv[1] = &tics; *sts = sys$cmexec(&uptime, argv); tp->tv_sec = tics / 100; tp->tv_nsec = (tics % 100) * 10000000; pwr_Assert(tp->tv_sec >= 0 && tp->tv_nsec >= 0); if (ap != NULL) return time_Dadd(tp, tp, ap); else return tp; }
/* * plc_LoopGetVmsUpTime() * * Description: * Gets the VMS uptime * */ pwr_tStatus plc_LoopGetVmsUpTime ( unsigned int *Seconds, unsigned int *Ticks /* 1 tick = 10 ms */ ) { void *argv[3]; pwr_tStatus sts; argv[0] = (void *) 2; argv[1] = Seconds; argv[2] = Ticks; sts = sys$cmexec(&GetVmsUpTime, argv); return sts; }
static pwr_tTime * nowTime ( pwr_tTime *tp ) { #if defined OS_VMS /* This code is valid up to 497 days after boot. */ void *argv[3]; pwr_tStatus sts; argv[0] = (void *) 2; argv[1] = &tp->tv_sec; argv[2] = &tp->tv_nsec; sts = sys$cmexec(&vmsUpTime, argv); tp->tv_nsec %= 100; tp->tv_nsec *= 10000000; #elif defined OS_ELN pwr_tStatus sts; int tmp[2]; int div = -10000000; ker$get_uptime(&sts, &tmp); sts = lib$ediv(&div, &tmp, &tp->tv_sec, &tp->tv_nsec); tp->tv_nsec *= -100; #elif defined OS_LYNX clock_gettime(CLOCK_REALTIME, tp); #endif return tp; }
time_tClock time_Clock ( pwr_tStatus *status, pwr_tDeltaTime *ap ) { long tics; struct tms buff; void *argv[2]; pwr_dStatus(sts, status, TIME__SUCCESS); argv[0] = (void *) 1; argv[1] = &tics; *sts = sys$cmexec(&uptime, argv); if (ap != NULL) { tics += ap->tv_sec * 100 + ap->tv_nsec / 10000000; } return tics; }