Skip to content

Commit

Permalink
Added constructor for Time
Browse files Browse the repository at this point in the history
  • Loading branch information
BaqablH committed Feb 5, 2021
1 parent c43b603 commit ef0c894
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions include/just_gtfs/just_gtfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@ class Time
inline Time() = default;
inline explicit Time(const std::string & raw_time_str);
inline Time(uint16_t hours, uint16_t minutes, uint16_t seconds);
inline Time(size_t seconds);
inline bool is_provided() const;
inline size_t get_total_seconds() const;
inline std::tuple<uint16_t, uint16_t, uint16_t> get_hh_mm_ss() const;
Expand Down Expand Up @@ -543,6 +544,13 @@ inline Time::Time(uint16_t hours, uint16_t minutes, uint16_t seconds)
time_is_provided = true;
}

inline Time::Time(size_t seconds)
: time_is_provided(true), total_seconds(seconds),
hh(seconds / 3600), mm((seconds % 3600) / 60), ss(seconds % 3600)
{
set_raw_time();
}

inline bool Time::is_provided() const { return time_is_provided; }

inline size_t Time::get_total_seconds() const { return total_seconds; }
Expand Down

0 comments on commit ef0c894

Please sign in to comment.