Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/system-time.ql
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ predicate isIrrelevantPackage(string packageName) {
from CallExpr call
where
call.getTarget().getQualifiedName() = "time.Now" and
not call.getParent().(CallExpr).getTarget().getQualifiedName() = "Round" and
not call.getParent*().(CallExpr).getTarget().getQualifiedName() = "UTC" and
// string formatting is usually a false positive (used in logging etc.),
// so it's usually ok to ignore.
// but there could be false negatives (if the string formatting output is written to a consensus state)
Expand Down Expand Up @@ -46,4 +48,5 @@ where
|
c.getAComment().getText().matches("%SAFE:%")
)
select call, "Calling the system time may be a possible source of non-determinism"
select call,
"Calling the system time may be a possible source of non-determinism. Use time.Now().Round(0).UTC() instead."