Skip to content

Commit 6df939f

Browse files
committed
Detect EPICS epoch zero in PVA timestamp
1 parent 5040433 commit 6df939f

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

core/pv/src/main/java/org/phoebus/pv/pva/Decoders.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2019-2020 Oak Ridge National Laboratory.
2+
* Copyright (c) 2019-2022 Oak Ridge National Laboratory.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v1.0
55
* which accompanies this distribution, and is available at
@@ -160,7 +160,14 @@ static Time decodeTime(final PVAStructure struct)
160160
timestamp = NO_TIME;
161161
usertag = NO_USERTAG;
162162
}
163-
return Time.of(timestamp, usertag, timestamp.getEpochSecond() > 0);
163+
164+
// A time stamp of all zeroes is not valid.
165+
// In addition, a time stamp of 1990/01/02 00:00:00
166+
// as used for the Channel Access and IOC time stamp epoch
167+
// is considered invalid because IOCs send it for never processed records
168+
final boolean valid = timestamp.getNano() != 0 &&
169+
(timestamp.getEpochSecond() > 0 && timestamp.getEpochSecond() != 631152000L);
170+
return Time.of(timestamp, usertag, valid);
164171
}
165172

166173
/** @param printfFormat Format from NTScalar display.format

0 commit comments

Comments
 (0)