{"id":2114,"url":"https://patchwork.libcamera.org/api/patches/2114/?format=json","web_url":"https://patchwork.libcamera.org/patch/2114/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20191006053226.8976-10-laurent.pinchart@ideasonboard.com>","date":"2019-10-06T05:32:26","name":"[libcamera-devel,9/9] test: timer: Test start() with absolute deadline","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"9153d017d68c1f5a72b3def19594906e81b35851","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/2114/mbox/","series":[{"id":522,"url":"https://patchwork.libcamera.org/api/series/522/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=522","date":"2019-10-06T05:32:17","name":"Timer fixes and enhancements","version":1,"mbox":"https://patchwork.libcamera.org/series/522/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/2114/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/2114/checks/","tags":{},"headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 59A016196C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun,  6 Oct 2019 07:32:41 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(modemcable151.96-160-184.mc.videotron.ca [184.160.96.151])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id B659FDD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun,  6 Oct 2019 07:32:40 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1570339961;\n\tbh=K4zCgQQ/cfTe4ehoUQ4IDib/z6/RbtUFOL7+XatkA0Y=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=M3ABP5AkNMoiyci+3ihzqGYP72CGeQRbI4ycDgGh4x5EBSRVi112SwYYEpnIUMIWv\n\tsyLdV7yWRz55ZjoCTuLsFEeyxdrKwQvy8ymNbnRBZCL3a2YV9lwqjlKaybE18UbC44\n\t7NAZesfOct/gMnRh1U5QJ9G6r9k8s8g9CSMK3OzM=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Sun,  6 Oct 2019 08:32:26 +0300","Message-Id":"<20191006053226.8976-10-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.21.0","In-Reply-To":"<20191006053226.8976-1-laurent.pinchart@ideasonboard.com>","References":"<20191006053226.8976-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 9/9] test: timer: Test start() with\n\tabsolute deadline","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Sun, 06 Oct 2019 05:32:41 -0000"},"content":"Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n test/timer.cpp | 19 +++++++++++++++++++\n 1 file changed, 19 insertions(+)","diff":"diff --git a/test/timer.cpp b/test/timer.cpp\nindex 5ff94dbbdeb0..93ce26a0a9a3 100644\n--- a/test/timer.cpp\n+++ b/test/timer.cpp\n@@ -35,6 +35,15 @@ public:\n \t\tTimer::start(msec);\n \t}\n \n+\tvoid start(std::chrono::steady_clock::time_point deadline)\n+\t{\n+\t\tcount_ = 0;\n+\t\tstart_ = std::chrono::steady_clock::now();\n+\t\texpiration_ = std::chrono::steady_clock::time_point();\n+\n+\t\tTimer::start(deadline);\n+\t}\n+\n \tint jitter()\n \t{\n \t\tstd::chrono::steady_clock::duration duration = expiration_ - deadline();\n@@ -127,6 +136,16 @@ protected:\n \t\t\treturn TestFail;\n \t\t}\n \n+\t\t/* Timer with absolute deadline. */\n+\t\ttimer.start(std::chrono::steady_clock::now() + std::chrono::milliseconds(200));\n+\n+\t\tdispatcher->processEvents();\n+\n+\t\tif (timer.isRunning() || timer.jitter() > 50) {\n+\t\t\tcout << \"Absolute timer test failed\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n \t\t/* Two timers. */\n \t\ttimer.start(1000);\n \t\ttimer2.start(300);\n","prefixes":["libcamera-devel","9/9"]}