{"id":15507,"url":"https://patchwork.libcamera.org/api/patches/15507/?format=json","web_url":"https://patchwork.libcamera.org/patch/15507/","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":"<20220322131635.2869526-2-naush@raspberrypi.com>","date":"2022-03-22T13:16:33","name":"[libcamera-devel,v1,1/3] utils: timer: Allow Timer::start to use utils::Duration","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"1d4e22235ff9a1784c94647d92d2dbe41d36fe7b","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/15507/mbox/","series":[{"id":2983,"url":"https://patchwork.libcamera.org/api/series/2983/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2983","date":"2022-03-22T13:16:32","name":"V4L2 dequeue timeout","version":1,"mbox":"https://patchwork.libcamera.org/series/2983/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/15507/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/15507/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id E1CAFC0F1B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 22 Mar 2022 13:16:43 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8D1F0604E8;\n\tTue, 22 Mar 2022 14:16:43 +0100 (CET)","from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com\n\t[IPv6:2a00:1450:4864:20::32d])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A9010604C5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Mar 2022 14:16:39 +0100 (CET)","by mail-wm1-x32d.google.com with SMTP id r64so10923943wmr.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Mar 2022 06:16:39 -0700 (PDT)","from naush-laptop.pitowers.org\n\t([2a00:1098:3142:14:9e9a:99af:e5a6:319b])\n\tby smtp.gmail.com with ESMTPSA id\n\tn14-20020a7bcbce000000b0038c7776a300sm2293478wmi.0.2022.03.22.06.16.38\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 22 Mar 2022 06:16:38 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1647955003;\n\tbh=g9npiaJ1NLUxGnHgqKHo+sbhVxhONahh4QBM2jPes6U=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=p1qhJ+1rQO2o4Qh64ge0PmpmumelGAWq1RUkceK0yF+sKw+ha2NQdztbLFPnUOOLu\n\t6vyJsZnaQJ6swtsYj3x9LCYZObqu7FkUuUR66x9aX4RDGGQ8/Zi3QhcjvF4uynxS7/\n\tyXK/4T/Ql0AadFRXxlJ261/p8+3iJhlNn6BoVQKjtVLFsYoOr3GM05BFpMS5BLUb4c\n\ttJbXqeFJV8aI6ITR4ljNrfnM4zsXqrVsN3xHBrW5vOzzQXeVIw5u1eU+6Fc0dGq1b4\n\tbo9y5haCeiuUEnlkP5q2/ozReB8hg3W0jlvTBe/6lUyyITJGfa4cZO8EXmSfqWvIDC\n\tjK2UGbPQsdeSQ==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=fnC/L+iITI19MxC5UkoX7mdIvfoQD2Z62GPX+M0fcUs=;\n\tb=a8o564gnXyng9PE1jo1M1mw5LW14UxFp306hpSMFKjHwc8zQSF+JtmmPy8bJ1Z2wf0\n\t/DnuO9+FEEnYIKisr2rYrtTYmEdE5wsloD9MJm808q6ACJCz4rjrS3tOHh3HyAH4Mnig\n\tl/P5TcHASe5tiD2e7MhdTtUp/KOEgLgUEukf0B6A9ydme6YK6Hoj8AnfaPnEck+XCdRk\n\ta8NMncRnRj4s1jjwuzMQVHTURybalEx5a0E1b/dRO41cMMDLfOEEPLqiYfv90gwnjez3\n\tqNuJIhLNiyklQZgX6Dk3SDQxaTQevrYehpGBdG6ETY+kE2lGJN7VN76VErW01ilxegH1\n\tkIOQ=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"a8o564gn\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=fnC/L+iITI19MxC5UkoX7mdIvfoQD2Z62GPX+M0fcUs=;\n\tb=BkaeTGvnkltT++HFmG/tHhJuQh+fKJuTUOphvE8u16dJL0HOHJn3ngndpcO5QYkJkk\n\tQMGHPwURq+gxZfHy6TOmrRn+o+o9txSsErnM6JzaqnvIsKUllVqDGXHcpp8HN1Vx3tvb\n\tJ+QxPWvsa47ZNoJ2NRZakAz9+TvWnwv2vwciPMfql9OY5m3yqmxVnYMZxxL2+38JMcGH\n\t/SZQADRdnO4bKTdVU14QeWG+7gJpazdgAtiyGpx0QH4eb5moMr4tlELkwtGD01Vv0WD+\n\tpAyOFild3psBxK6tcK9T/iSd3yKpzSUW2eOO5Li1rqTdLQ6B0jk7RyvG9M5mZeez0OoT\n\tIynw==","X-Gm-Message-State":"AOAM532tRnVRXqIlD7pIMB/iMwi0UGHZdMH/+kROZ2mv9Qb+MEmw0axq\n\ttE/FUnL/6ONs9hkEz4qiDIWtQAC8cctMAQ==","X-Google-Smtp-Source":"ABdhPJwWZJUlmA43+vd2p02VDwKH18gABY+ar9DSxRQw2eBU0eE11X2i0uj4DZ+9vNocyjJPIczD9A==","X-Received":"by 2002:adf:fe10:0:b0:203:d794:93e6 with SMTP id\n\tn16-20020adffe10000000b00203d79493e6mr22337218wrr.588.1647954999195; \n\tTue, 22 Mar 2022 06:16:39 -0700 (PDT)","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 22 Mar 2022 13:16:33 +0000","Message-Id":"<20220322131635.2869526-2-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20220322131635.2869526-1-naush@raspberrypi.com>","References":"<20220322131635.2869526-1-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v1 1/3] utils: timer: Allow Timer::start\n\tto use utils::Duration","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>","From":"Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Naushir Patuck <naush@raspberrypi.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Add an overload of the Timer::start member function to accept a utils::Duration\ntype for the timer duration.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n include/libcamera/base/timer.h |  2 ++\n src/libcamera/base/timer.cpp   | 14 ++++++++++++++\n 2 files changed, 16 insertions(+)","diff":"diff --git a/include/libcamera/base/timer.h b/include/libcamera/base/timer.h\nindex 09f1d3229bd5..f42a8cfd4d6d 100644\n--- a/include/libcamera/base/timer.h\n+++ b/include/libcamera/base/timer.h\n@@ -14,6 +14,7 @@\n \n #include <libcamera/base/object.h>\n #include <libcamera/base/signal.h>\n+#include <libcamera/base/utils.h>\n \n namespace libcamera {\n \n@@ -27,6 +28,7 @@ public:\n \n \tvoid start(unsigned int msec) { start(std::chrono::milliseconds(msec)); }\n \tvoid start(std::chrono::milliseconds duration);\n+\tvoid start(utils::Duration duration);\n \tvoid start(std::chrono::steady_clock::time_point deadline);\n \tvoid stop();\n \tbool isRunning() const;\ndiff --git a/src/libcamera/base/timer.cpp b/src/libcamera/base/timer.cpp\nindex 187336e3a1a4..3ff526aea8ae 100644\n--- a/src/libcamera/base/timer.cpp\n+++ b/src/libcamera/base/timer.cpp\n@@ -85,6 +85,20 @@ void Timer::start(std::chrono::milliseconds duration)\n \tstart(utils::clock::now() + duration);\n }\n \n+/**\n+ * \\brief Start or restart the timer with a timeout of \\a duration\n+ * \\param[in] duration The timer duration given by \\a utils::Duration\n+ *\n+ * If the timer is already running it will be stopped and restarted.\n+ *\n+ * \\context This function is \\threadbound.\n+ */\n+void Timer::start(utils::Duration duration)\n+{\n+\tauto msec = std::chrono::duration_cast<std::chrono::milliseconds>(duration);\n+\tstart(utils::clock::now() + msec);\n+}\n+\n /**\n  * \\brief Start or restart the timer with a \\a deadline\n  * \\param[in] deadline The timer deadline\n","prefixes":["libcamera-devel","v1","1/3"]}