mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-21 18:08:25 +00:00
Implement storage routines for periodic scheduler
This commit is contained in:
@ -28,6 +28,8 @@ case class Timestamp(value: Instant) {
|
||||
def atZone(zone: ZoneId): ZonedDateTime =
|
||||
value.atZone(zone)
|
||||
|
||||
def atUTC: ZonedDateTime = atZone(Timestamp.UTC)
|
||||
|
||||
def asString: String = value.toString
|
||||
}
|
||||
|
||||
@ -39,6 +41,9 @@ object Timestamp {
|
||||
def current[F[_]: Sync]: F[Timestamp] =
|
||||
Sync[F].delay(Timestamp(Instant.now))
|
||||
|
||||
def from(zd: ZonedDateTime): Timestamp =
|
||||
Timestamp(zd.toInstant)
|
||||
|
||||
implicit val encodeTimestamp: Encoder[Timestamp] =
|
||||
BaseJsonCodecs.encodeInstantEpoch.contramap(_.value)
|
||||
|
||||
|
Reference in New Issue
Block a user