mirror of
https://github.com/status-im/dagger-contracts.git
synced 2025-01-11 14:55:06 +00:00
13 lines
427 B
JavaScript
13 lines
427 B
JavaScript
const now = () => Math.round(Date.now() / 1000)
|
|
const hours = (amount) => amount * minutes(60)
|
|
const minutes = (amount) => amount * seconds(60)
|
|
const seconds = (amount) => amount
|
|
|
|
const periodic = (length) => ({
|
|
periodOf: (timestamp) => Math.floor(timestamp / length),
|
|
periodStart: (period) => period * length,
|
|
periodEnd: (period) => (period + 1) * length,
|
|
})
|
|
|
|
module.exports = { now, hours, minutes, seconds, periodic }
|