Skip to content

Commit

Permalink
fix: Normalize the Time-I record timestamp to 1s.
Browse files Browse the repository at this point in the history
Time-I displays the time without the ms part which means it has to be
rounded accordingly.
  • Loading branch information
jerzyjamroz committed Nov 24, 2023
1 parent f5fda11 commit 7e304b2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion evrApp/src/devEvrStringIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,18 @@ try {
if (ts.secPastEpoch==priv->last_bad)
return 0;

// Normalize the timestamp to seconds
epicsTimeStamp ts_sec = ts;
// Round the timestamp to 1s accuracy
if (ts_sec.nsec + 500000000u >= 1000000000u)
ts_sec.secPastEpoch += 1;

ts_sec.nsec = 0; // Remove the ns part

size_t r=epicsTimeToStrftime(prec->val,
sizeof(prec->val),
"%a, %d %b %Y %H:%M:%S %z",
&ts);
&ts_sec);
if(r==0||r==sizeof(prec->val)){
recGblRecordError(S_dev_badArgument, (void*)prec,
"Format string resulted in error");
Expand Down
2 changes: 1 addition & 1 deletion mrfCommon/src/mrfCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ struct SB {
*
* To quote the manual:
* Subrelease ID For production releases the subrelease ID counts up from 00.
* For pre-releases this ID is used backwards counting down from ff i.e. when
* For pre-releases this ID is used "backwards" counting down from ff i.e. when
* approacing release 12000207, we have prereleases 12FF0206, 12FE0206,
* 12FD0206 etc. in this order.
*/
Expand Down

0 comments on commit 7e304b2

Please sign in to comment.