codex-contracts-eth/test/time.js

12 lines
374 B
JavaScript
Raw Permalink Normal View History

2022-02-15 16:01:54 +00:00
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 = { hours, minutes, seconds, periodic }