UnixEpochDays returns the number of days since the Unix epoch. Infinite dates are converted to MinInt64 or MaxInt64.
()
| 208 | // UnixEpochDays returns the number of days since the Unix epoch. Infinite |
| 209 | // dates are converted to MinInt64 or MaxInt64. |
| 210 | func (d Date) UnixEpochDays() int64 { |
| 211 | if d.days == math.MinInt32 { |
| 212 | return math.MinInt64 |
| 213 | } |
| 214 | if d.days == math.MaxInt32 { |
| 215 | return math.MaxInt64 |
| 216 | } |
| 217 | // Converting to an int64 makes overflow impossible. |
| 218 | return int64(d.days) + unixEpochToPGEpoch |
| 219 | } |
| 220 | |
| 221 | // UnixEpochDaysWithOrig returns the original on-disk representation if |
| 222 | // present, otherwise UnixEpochDays(). |
no outgoing calls
no test coverage detected