diff options
author | brooks <brooks@FreeBSD.org> | 2017-03-17 07:12:44 +0800 |
---|---|---|
committer | brooks <brooks@FreeBSD.org> | 2017-03-17 07:12:44 +0800 |
commit | a005ad36f370ba976262017c73eb40c54b32e5a1 (patch) | |
tree | 31be20e4e70ec766e60f89c498fb38d7384bbfd1 /devel | |
parent | 4b8c29bd5a921a0decd15353819da0fd55409e5c (diff) | |
download | freebsd-ports-gnome-a005ad36f370ba976262017c73eb40c54b32e5a1.tar.gz freebsd-ports-gnome-a005ad36f370ba976262017c73eb40c54b32e5a1.tar.zst freebsd-ports-gnome-a005ad36f370ba976262017c73eb40c54b32e5a1.zip |
Hack around wall clock time going backwards.
As reported in https://github.com/jmmv/kyua/issues/155, the wall clock
time can go backwards resulting in an apparent negative delta. As
a workaround, convert such deltas to 1us. This allows tests to run
successfully in MIPS64 qemu.
Approved by: jmmv (maintainer)
Sponsored by: DARPA, AFRL
Diffstat (limited to 'devel')
-rw-r--r-- | devel/kyua/Makefile | 1 | ||||
-rw-r--r-- | devel/kyua/files/patch-utils_datetime.cpp | 23 |
2 files changed, 24 insertions, 0 deletions
diff --git a/devel/kyua/Makefile b/devel/kyua/Makefile index 897727502a7e..19f9a03d3c0e 100644 --- a/devel/kyua/Makefile +++ b/devel/kyua/Makefile @@ -3,6 +3,7 @@ PORTNAME= kyua PORTVERSION= 0.13 PORTEPOCH= 3 +PORTREVISION= 1 CATEGORIES= devel MASTER_SITES= https://github.com/jmmv/kyua/releases/download/${PORTNAME}-${PORTVERSION}/ \ LOCAL/jmmv diff --git a/devel/kyua/files/patch-utils_datetime.cpp b/devel/kyua/files/patch-utils_datetime.cpp new file mode 100644 index 000000000000..62b1dda69b02 --- /dev/null +++ b/devel/kyua/files/patch-utils_datetime.cpp @@ -0,0 +1,23 @@ + +$FreeBSD$ + +--- utils/datetime.cpp.orig ++++ utils/datetime.cpp +@@ -590,11 +590,12 @@ + datetime::delta + datetime::timestamp::operator-(const datetime::timestamp& other) const + { +- if ((*this) < other) { +- throw std::runtime_error( +- F("Cannot subtract %s from %s as it would result in a negative " +- "datetime::delta, which are not supported") % other % (*this)); +- } ++ /* ++ * XXX-BD: gettimeofday isn't necessicarily monotonic so return the ++ * smallest non-zero delta if time went backwards. ++ */ ++ if ((*this) < other) ++ return datetime::delta::from_microseconds(1); + return datetime::delta::from_microseconds(to_microseconds() - + other.to_microseconds()); + } |