mirror of
https://github.com/codex-storage/nim-codex.git
synced 2025-01-09 20:45:38 +00:00
56b80d6f6d
* move por into storage proofs * use SeekableStream * adding serialization for por * remove leftovers * add empty block support * add basic por test * rename block exchange for consistency * add storageproofstests * moving timing to storageproofs * fix imports * fix imports * fix imports * add top level exports * move delete blocks helper to helpers * more import/export fixes * cleanup * more import fixes * fix unused warnings * detect corrupt blocks tests * add serialization tests * move init method around * bump asynctest * fix CID version * get rid of warning * wip: fix CI * increase CI timeout
17 lines
437 B
Nim
17 lines
437 B
Nim
import pkg/stint
|
|
|
|
type
|
|
Periodicity* = object
|
|
seconds*: UInt256
|
|
Period* = UInt256
|
|
Timestamp* = UInt256
|
|
|
|
func periodOf*(periodicity: Periodicity, timestamp: Timestamp): Period =
|
|
timestamp div periodicity.seconds
|
|
|
|
func periodStart*(periodicity: Periodicity, period: Period): Timestamp =
|
|
period * periodicity.seconds
|
|
|
|
func periodEnd*(periodicity: Periodicity, period: Period): Timestamp =
|
|
periodicity.periodStart(period + 1)
|