Commit e974cea4 authored by claes's avatar claes

Changed csup_Exec to use CLOCK_MONTONIC

parent db89d4eb
/* /*
* Proview $Id: rt_emon.c,v 1.13 2008-01-24 09:56:58 claes Exp $ * Proview $Id: rt_emon.c,v 1.14 2008-09-30 14:00:54 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -1205,16 +1205,17 @@ cSup_exec ( ...@@ -1205,16 +1205,17 @@ cSup_exec (
) )
{ {
pwr_sClass_CycleSup *o = (pwr_sClass_CycleSup *) sp->op; pwr_sClass_CycleSup *o = (pwr_sClass_CycleSup *) sp->op;
pwr_tDeltaTime dnow; pwr_tTime dnow;
pwr_tDeltaTime nextLimit; pwr_tTime nextLimit;
int diff; int diff;
time_Uptime(NULL, &dnow, NULL); // time_Uptime(NULL, &dnow, NULL);
clock_gettime(CLOCK_MONOTONIC, &dnow);
nextLimit.tv_nsec = o->NextLimit.tv_nsec; nextLimit.tv_nsec = o->NextLimit.tv_nsec;
nextLimit.tv_sec = o->NextLimit.tv_sec; nextLimit.tv_sec = o->NextLimit.tv_sec;
o->DetectCount++; o->DetectCount++;
diff = time_Dcomp(&dnow, &nextLimit); diff = time_Acomp(&dnow, &nextLimit);
if (diff > 0 || (o->Delayed && !o->DelayNoted)) { if (diff > 0 || (o->Delayed && !o->DelayNoted)) {
if (o->AlarmCheck && o->DetectOn && !o->Blocked) { if (o->AlarmCheck && o->DetectOn && !o->Blocked) {
......
/* /*
* Proview $Id: rt_io_comm.c,v 1.5 2007-05-18 12:04:17 claes Exp $ * Proview $Id: rt_io_comm.c,v 1.6 2008-09-30 14:05:14 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -78,8 +78,8 @@ int main (int argc, char **argv) ...@@ -78,8 +78,8 @@ int main (int argc, char **argv)
char mp[2000]; char mp[2000];
qcom_sGet get; qcom_sGet get;
pwr_tTime now; pwr_tTime now;
pwr_tDeltaTime next; pwr_tTime next;
pwr_tDeltaTime after; pwr_tTime after;
pwr_tDeltaTime cycle; pwr_tDeltaTime cycle;
lst_sEntry *csup_lh; lst_sEntry *csup_lh;
int delay_action = 0; int delay_action = 0;
...@@ -106,6 +106,7 @@ int main (int argc, char **argv) ...@@ -106,6 +106,7 @@ int main (int argc, char **argv)
if (init_io) { if (init_io) {
double f; double f;
sts = io_init(io_mProcess_IoComm, pwr_cNObjid, &io_ctx, 1, ihp->CycleTimeBus); sts = io_init(io_mProcess_IoComm, pwr_cNObjid, &io_ctx, 1, ihp->CycleTimeBus);
if ( ODD(sts)) if ( ODD(sts))
errh_SetStatus( PWR__SRUN); errh_SetStatus( PWR__SRUN);
...@@ -120,7 +121,8 @@ int main (int argc, char **argv) ...@@ -120,7 +121,8 @@ int main (int argc, char **argv)
cycle.tv_sec = f; cycle.tv_sec = f;
cycle.tv_nsec = (ihp->CycleTimeBus - f) * 1.0e9; cycle.tv_nsec = (ihp->CycleTimeBus - f) * 1.0e9;
cycle.tv_nsec++; cycle.tv_nsec++;
time_Uptime(&sts, &next, &cycle); clock_gettime(CLOCK_MONOTONIC, &next);
time_Aadd(NULL, &next, &cycle);
} }
get.maxSize = sizeof(mp); get.maxSize = sizeof(mp);
...@@ -138,9 +140,11 @@ int main (int argc, char **argv) ...@@ -138,9 +140,11 @@ int main (int argc, char **argv)
io_ScanSupLst( io_ctx->SupCtx); io_ScanSupLst( io_ctx->SupCtx);
clock_gettime(CLOCK_REALTIME, &now); clock_gettime(CLOCK_REALTIME, &now);
time_Uptime(&sts, &after, NULL); clock_gettime(CLOCK_MONOTONIC, &after);
time_Uptime(&sts, &next, &cycle); next = after;
delay_action = csup_Exec(&sts, csup_lh, &next, &after, &now); time_Aadd(NULL, &next, &cycle);
delay_action = csup_Exec(&sts, csup_lh, (pwr_tDeltaTime *) &next,
(pwr_tDeltaTime *) &after, &now);
if (delay_action == 2) if (delay_action == 2)
ihp->IOReadWriteFlag = FALSE; ihp->IOReadWriteFlag = FALSE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment