Skip to content

Commit b7c1628

Browse files
authored
add secondsSinceEpoch to trantor::Date (#117)
1 parent 26b2e53 commit b7c1628

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

trantor/utils/Date.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,16 @@ class Date
167167
return microSecondsSinceEpoch_;
168168
}
169169

170+
/**
171+
* @brief Get the number of seconds since 1970-01-01 00:00.
172+
*
173+
* @return int64_t
174+
*/
175+
int64_t secondsSinceEpoch() const
176+
{
177+
return microSecondsSinceEpoch_ / MICRO_SECONDS_PRE_SEC;
178+
}
179+
170180
/**
171181
* @brief Get the tm struct for the time point.
172182
*

0 commit comments

Comments
 (0)