diff options
author | KT <tran0563@umn.edu> | 2021-10-04 21:25:55 -0500 |
---|---|---|
committer | KT <tran0563@umn.edu> | 2021-10-04 21:25:55 -0500 |
commit | 427e0e31a7ba3d947aac97b30d9397dad329078d (patch) | |
tree | 534bb19ea21c593d314ce32ae875012df0338ed1 /dev/a3-earthquake/date.h | |
parent | publish a2 (diff) | |
download | csci4611-427e0e31a7ba3d947aac97b30d9397dad329078d.tar csci4611-427e0e31a7ba3d947aac97b30d9397dad329078d.tar.gz csci4611-427e0e31a7ba3d947aac97b30d9397dad329078d.tar.bz2 csci4611-427e0e31a7ba3d947aac97b30d9397dad329078d.tar.lz csci4611-427e0e31a7ba3d947aac97b30d9397dad329078d.tar.xz csci4611-427e0e31a7ba3d947aac97b30d9397dad329078d.tar.zst csci4611-427e0e31a7ba3d947aac97b30d9397dad329078d.zip |
Publish a3
Diffstat (limited to 'dev/a3-earthquake/date.h')
-rw-r--r-- | dev/a3-earthquake/date.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/dev/a3-earthquake/date.h b/dev/a3-earthquake/date.h new file mode 100644 index 0000000..8768745 --- /dev/null +++ b/dev/a3-earthquake/date.h @@ -0,0 +1,50 @@ +/** CSci-4611 Assignment 3: Earthquake + */ + +#ifndef DATE_H_ +#define DATE_H_ + +#include <ctime> +#include <iostream> + +/** A date class that handles leap years and can convert itself to seconds and + handle < and > operations. + */ +class Date { +public: + Date(); + Date(double seconds); + Date(int m, int d, int y); + Date(int m, int d, int y, int hr, int min, double sec); + + bool operator<(const Date& other); + bool operator>(const Date& other); + + double ToSeconds() const; + + double SecondsUntil(const Date& other) const; + + int year(); + + int month(); + + int day(); + + int hour(); + + int minute(); + + double second(); + +private: + std::time_t ctime_; + int fouryears_; + int year_; + int month_; + int day_; + int hour_; + int minute_; + double second_; +}; + +#endif |