33// that can be found in the LICENSE file.
44module time
55
6- // unix returns a Time calculated from the given Unix timestamp in seconds since 1970-01-01
6+ // unix returns a Time calculated from the given Unix timestamp in seconds since 1970-01-01 .
77pub fn unix (epoch i64 ) Time {
88 return unix_nanosecond (epoch, 0 )
99}
1010
11- // unix_milli returns a Time calculated from the given Unix timestamp in milliseconds since 1970-01-01
11+ // unix_milli returns a Time calculated from the given Unix timestamp in milliseconds since 1970-01-01 .
1212pub fn unix_milli (ms i64 ) Time {
1313 return ts_to_time_impl (ms, 1_000 , 1_000_000 )
1414}
1515
16- // unix_micro returns a Time calculated from the given Unix timestamp in microseconds since 1970-01-01
16+ // unix_micro returns a Time calculated from the given Unix timestamp in microseconds since 1970-01-01 .
1717pub fn unix_micro (us i64 ) Time {
1818 return ts_to_time_impl (us, 1_000_000 , 1_000 )
1919}
2020
21- // unix_nano returns a Time calculated from the given Unix timestamp in nanoseconds since 1970-01-01
21+ // unix_nano returns a Time calculated from the given Unix timestamp in nanoseconds since 1970-01-01 .
2222pub fn unix_nano (ns i64 ) Time {
2323 return ts_to_time_impl (ns, 1_000_000_000 , 1 )
2424}
@@ -29,12 +29,12 @@ fn ts_to_time_impl(value i64, down i64, up i64) Time {
2929 return unix_nanosecond (epoch, int (remainder))
3030}
3131
32- // unix_microsecond returns a Time struct, given an Unix timestamp in seconds, and a microsecond value
32+ // unix_microsecond returns a Time struct, given an Unix timestamp in seconds, and a microsecond value.
3333pub fn unix_microsecond (epoch i64 , microsecond int ) Time {
3434 return unix_nanosecond (epoch, microsecond * 1000 )
3535}
3636
37- // unix_nanosecond returns a Time struct given a Unix timestamp in seconds and a nanosecond value
37+ // unix_nanosecond returns a Time struct given a Unix timestamp in seconds and a nanosecond value.
3838pub fn unix_nanosecond (abs_unix_timestamp i64 , nanosecond int ) Time {
3939 // Split into day and time
4040 mut day_offset := abs_unix_timestamp / seconds_per_day
0 commit comments