Beamlib 3.3.2
This is the Beam C++ class library.
Loading...
Searching...
No Matches
BDuration.h
Go to the documentation of this file.
1/*******************************************************************************
2 * BDuration.h A time duration class
3 * T.Barnaby, BEAM Ltd, 2010-02-11
4 * Copyright (c) 2022 All Right Reserved, Beam Ltd, https://www.beam.ltd.uk
5 * For license see LICENSE.txt at the root of the beamlib source tree.
6 *******************************************************************************
7 */
8#ifndef BDuration_H
9#define BDuration_H 1
10
11#include <stdint.h>
12#include <BError.h>
13
15class BDuration {
16public:
17 BDuration(int hour = 0, int minute = 0, int second = 0, int microsecond = 0);
18 BDuration(BString str);
19 ~BDuration();
20
21 void clear();
22
23 void set(int hour = 0, int minute = 0, int second = 0, int microsecond = 0);
24
25 void addMilliSeconds(int64_t milliSeconds);
26 void addMicroSeconds(int64_t microSeconds);
27 void addSeconds(int seconds);
28 uint32_t getSeconds();
29 uint64_t getMicroSeconds();
30
31 int hour();
32 int minute();
33 int second();
34 int microSecond();
35
38
39private:
40 uint8_t ohour;
41 uint8_t ominute;
42 uint8_t osecond;
43 uint8_t ospare;
44 uint32_t omicroSecond;
45
46};
47
48#endif
Stores and manipulates a time to the nearest microsecond and a maximum of 24 hours.
Definition: BDuration.h:15
int second()
Definition: BDuration.cpp:46
int minute()
Definition: BDuration.cpp:42
int microSecond()
Definition: BDuration.cpp:50
uint64_t getMicroSeconds()
Get number of micro seconds.
Definition: BDuration.cpp:167
BError setString(BString time)
Set the time from an ISO date/time.
Definition: BDuration.cpp:62
void addSeconds(int seconds)
Add the given number of seconds.
Definition: BDuration.cpp:117
uint32_t getSeconds()
Get number of seconds.
Definition: BDuration.cpp:157
void addMicroSeconds(int64_t microSeconds)
Add the given number of micro seconds.
Definition: BDuration.cpp:87
void set(int hour=0, int minute=0, int second=0, int microsecond=0)
Definition: BDuration.cpp:30
BString getString()
Get the time as an ISO date/time string.
Definition: BDuration.cpp:54
~BDuration()
Definition: BDuration.cpp:23
int hour()
Definition: BDuration.cpp:38
void clear()
Clear the duration.
Definition: BDuration.cpp:26
void addMilliSeconds(int64_t milliSeconds)
Add the given number of milli seconds.
Definition: BDuration.cpp:102
Error return class. This class is used to return the error status from a function....
Definition: BError.h:31
This class stores and manipulates ASCII strings.
Definition: BString.h:20