All Downloads are FREE. Search and download functionalities are using the official Maven repository.

dererXII.scalashogi_2.13.5.0.2.source-code.Timestamp.scala Maven / Gradle / Ivy

There is a newer version: 12.1.1
Show newest version
package shogi

final case class Timestamp(value: Long) extends AnyVal with Ordered[Timestamp] {

  def -(o: Timestamp) = Centis.ofMillis(value - o.value)

  def +(o: Centis) = Timestamp(value + o.millis)

  def compare(other: Timestamp) = java.lang.Long.compare(value, other.value)
}

trait Timestamper {
  def now: Timestamp

  def toNow(ts: Timestamp) = now - ts
}

private[shogi] object RealTimestamper extends Timestamper {
  def now = new Timestamp(System.currentTimeMillis)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy