Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Mar 2017 23:12:44 +0000 (UTC)
From:      Brooks Davis <brooks@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r436312 - in head/devel/kyua: . files
Message-ID:  <201703162312.v2GNCiKx096404@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: brooks
Date: Thu Mar 16 23:12:44 2017
New Revision: 436312
URL: https://svnweb.freebsd.org/changeset/ports/436312

Log:
  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

Added:
  head/devel/kyua/files/patch-utils_datetime.cpp   (contents, props changed)
Modified:
  head/devel/kyua/Makefile

Modified: head/devel/kyua/Makefile
==============================================================================
--- head/devel/kyua/Makefile	Thu Mar 16 23:00:08 2017	(r436311)
+++ head/devel/kyua/Makefile	Thu Mar 16 23:12:44 2017	(r436312)
@@ -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

Added: head/devel/kyua/files/patch-utils_datetime.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/kyua/files/patch-utils_datetime.cpp	Thu Mar 16 23:12:44 2017	(r436312)
@@ -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());
+ }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703162312.v2GNCiKx096404>