Files
libpigpio/pigchrono.h
2025-08-05 22:33:23 +02:00

54 lines
1.1 KiB
C++

/*****************************************************************************
source::worx libPiGPio
Copyright © 2022 c.holzheuer
chris@sourceworx.org
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Uses:
pigpiod_if2 by joan2937, pigpio @ abyz.me.uk
https://abyz.me.uk/rpi/pigpio
sigslot by 2017 Pierre-Antoine Lacaze
https://github.com/palacaze/sigslot
***************************************************************************/
#ifndef PIGCHRONO_H
#define PIGCHRONO_H
#include <chrono>
#include <libpigpio.h>
using namespace std;
using namespace chrono;
class LIBPIGPIO_EXPORT pigChrono
{
public:
pigChrono();
virtual ~pigChrono() = default;
void start();
double elapsed_millis() const;
double elapsed_micros() const;
protected:
using _clock = high_resolution_clock;
time_point<_clock> _beg;
};
#endif // PIGCHRONO_H