Website Summary Files Commits Branches @commit @diff @stats
path: root / Sem. 06 / Event / Time.h
diff options
context:
space:
mode:
Commitd3c133e918cb85933c961c31871d038cace6b638 (patch)
Author
 Angel Dimitriev <achi_d@abv.bg>
2022-03-29 20:00:49 +0300
Committer
 GitHub <noreply@github.com>
2022-03-29 20:00:49 +0300
Files200177f14d906fe71e7745aec9799c4c0b11171f /Sem. 06/Event/Time.h
Object-oriented_programming_FMI-d3c133e918cb85933c961c31871d038cace6b638.tar
Object-oriented_programming_FMI-d3c133e918cb85933c961c31871d038cace6b638.tar.gz
Object-oriented_programming_FMI-d3c133e918cb85933c961c31871d038cace6b638.zip
Parent4b875f477c0eaa55ee1ea81949af6c6010249888 (diff)
Add files via upload
1 files changed, 41 insertions, 0 deletions
-rw-r--r--Sem. 06/Event/Time.h41
diff --git a/Sem. 06/Event/Time.h b/Sem. 06/Event/Time.h
new file mode 100644
index 0000000..be90962
--- /dev/null
+++ b/Sem. 06/Event/Time.h
@@ -0,0 +1,41 @@
+#pragma once
+#include <iostream>
+
+class Time
+{
+ size_t seconds; //[0...59]
+ size_t mins; //0...59
+ size_t hours; // 0...23
+
+ size_t convertToSeconds() const
+ {
+ return 3600 * hours + 60 * mins + seconds;
+ }
+
+
+public:
+ Time(); // 00:00:00
+ Time(size_t hours, size_t mins, size_t seconds);
+ Time(size_t seconds);
+
+
+ size_t getSeconds() const;
+ size_t getMins() const;
+ size_t getHours() const;
+
+ void setSeconds(size_t seconds);
+ void setMins(size_t mins);
+ void setHours(size_t hours);
+
+ void tick();
+
+ int compare(const Time& other) const;
+ Time getDiff(const Time& other) const;
+
+ Time getToMidnight() const;
+ bool isPartyTime() const;//23:00 05;00
+ bool isDinnerTime() const;//19:30 21:30
+
+ void print(bool is12hoursclock) const;
+
+}; \ No newline at end of file