Skip to content

Commit

Permalink
Release 1.2.10
Browse files Browse the repository at this point in the history
  • Loading branch information
darkfrog26 committed Apr 18, 2024
1 parent 7fe5ef0 commit 9a3e99a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType}

val allScalaVersions = List("2.12.19", "2.11.12", "2.13.13", "3.1.1")
val allScalaVersions = List("2.12.19", "2.13.13", "3.3.3")

name := "perfolation"
ThisBuild / organization := "com.outr"
ThisBuild / version := "1.2.9"
ThisBuild / version := "1.2.10"
ThisBuild / scalaVersion := "2.13.13"
ThisBuild / crossScalaVersions := allScalaVersions
ThisBuild / scalacOptions ++= Seq("-unchecked", "-deprecation")
Expand Down
14 changes: 7 additions & 7 deletions core/native/src/main/scala/perfolation/NativeCrossDate.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import scala.scalanative.unsafe.{Ptr, fromCString}
class NativeCrossDate(override val milliseconds: Long, dms: Ptr[time.time_t]) extends CrossDate {
time.tzset()
// tmOps object that allows us to access localtime data
val date = new tmOps(time.localtime(dms).asInstanceOf[Ptr[tm]])
private val date = new tmOps(time.localtime(dms))

private val dst: Int = if (time.daylight() == 1) {
private val dst: Int = if (time.daylight == 1) {
3600000
} else {
0
Expand All @@ -19,19 +19,19 @@ class NativeCrossDate(override val milliseconds: Long, dms: Ptr[time.time_t]) ex
override def hour24: Int = date.tm_hour
override def minuteOfHour: Int = date.tm_min
override def secondOfMinute: Int = date.tm_sec
override def milliOfSecond: Int = (milliseconds % 1000L).asInstanceOf[Int]
override def milliOfSecond: Int = (milliseconds % 1000L).toInt
override def isAM: Boolean = hour24 < 12
override def timeZoneOffsetMillis: Int = dst - (1000 * time.timezone().asInstanceOf[Int])
override def timeZoneOffsetMillis: Int = dst - (1000 * time.timezone.toInt)
override def year: Int = date.tm_year + 1900
override def month: Int = date.tm_mon
override def dayOfWeek: Int = date.tm_wday + 1
override def dayOfMonth: Int = date.tm_mday
override def dayOfYear: Int = date.tm_yday
override def timeZone: String = {
val ptr = if (time.daylight() == 0) {
time.tzname()._1
val ptr = if (time.daylight == 0) {
time.tzname._1
} else {
time.tzname()._2
time.tzname._2
}
fromCString(ptr)
}
Expand Down
2 changes: 1 addition & 1 deletion core/native/src/main/scala/perfolation/Platform.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import scala.scalanative.posix.time.time_t
object Platform {
def createDate(l: Long): CrossDate = {
val bmsptr = stackalloc[time_t]()
!bmsptr = l / 1000L
bmsptr(l / 1000L)

new NativeCrossDate(l, bmsptr)
}
Expand Down
3 changes: 1 addition & 2 deletions core/shared/src/main/scala/perfolation/CrossDate.scala
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,10 @@ object CrossDate {

def apply(l: Long): CrossDate = Option(cache.get()) match {
case Some(d) if d.milliseconds == l => d
case _ => {
case _ =>
val d = Platform.createDate(l)
cache.set(d)
d
}
}

object Week {
Expand Down

0 comments on commit 9a3e99a

Please sign in to comment.