PTime.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015-2018 Digital Barriers plc. All rights reserved.
3  * Contact: http://www.digitalbarriers.com/
4  *
5  * This file is part of the Papillon SDK.
6  *
7  * You can't use, modify or distribute any part of this file without
8  * the explicit written agreements of Digital Barriers.
9  */
10 
15 #pragma once
16 #include <PObject.h>
17 #include <PString.h>
18 
19 PAPILLON_BEGIN_NAMESPACE
20 
32 class PAPILLON_API_CORE PTime : public PObject
33 {
34 public:
43  explicit PTime(papillon::int32 h = 0, papillon::int32 m = 0, papillon::int32 s = 0, papillon::int32 ms = 0);
44 
48  PTime(const PTime& other);
49 
69  explicit PTime(const PString& str, const PString& format = PString("hh:mm:ss,zzz"));
70 
74  ~PTime();
75 
79  PTime& operator=(const PTime& other);
80 
84  static PTime Current();
85 
90  papillon::int32 GetHour() const;
91 
96  papillon::int32 GetMinute() const;
97 
102  papillon::int32 GetSecond() const;
103 
108  papillon::int32 GetMillisecond() const;
109 
113  bool IsValid() const;
114 
121  PTime AddMillisecond(papillon::int32 n) const;
122 
131  papillon::int32 GetMillisecondsTo(const PTime& t) const;
132 
138  papillon::int32 Compare(const PTime& other) const;
139 
143  bool operator!=(const PTime& t) const;
144 
148  bool operator<(const PTime& d) const;
149 
153  bool operator<=(const PTime& d) const;
154 
158  bool operator==(const PTime& d) const;
159 
163  bool operator>(const PTime& d) const;
164 
168  bool operator>=(const PTime& d) const;
169 
189  PString ToString(const PString& format = PString("hh:mm:ss,zzz")) const;
190 };
191 
192 PAPILLON_END_NAMESPACE
The PString class provides an Unicode character strings.
Definition: PString.h:37
The PTime class provides clock time functions; PTime instances are immutable (thread-safe).
Definition: PTime.h:32
The PObject class is the root class of all Papillon classes; all PObject behaves like shared referenc...
Definition: PObject.h:27
Class PString: an unicode character strings (use copy-on-write idiom).
PString ToString() const
Returns a string representation of this object.
Class PObject: the root class of all Papillon classes.
PObject & operator=(const PObject &obj)
Performs a shared copy of other to this object.
Definition: PObject.h:45