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

com.dadrox.scuttle.time.conversions.scala Maven / Gradle / Ivy

There is a newer version: 0.4
Show newest version
package com.dadrox.scuttle.time

object converters {
    implicit def intToDuration(value: Int) = new AugmentedInteger(value)
    implicit def longToDuration(value: Long) = new AugmentedInteger(value)

    class AugmentedInteger(value: Long) {
        def milliseconds() = Duration.fromMilliseconds(value)
        def millisecond() = milliseconds
        def millis() = milliseconds
        def milli() = milliseconds
        def ms() = milliseconds

        def seconds() = Duration.fromSeconds(value)
        def second() = seconds
        def minutes() = Duration.fromMinutes(value)
        def minute() = minutes
        def hours() = Duration.fromHours(value)
        def hour() = hours
        def days() = Duration.fromDays(value)
        def day() = days
        def weeks() = Duration.fromWeeks(value)
        def week() = weeks
    }
}

object conversions {
    implicit def javaDateToTime(date: java.util.Date): Time = Time.fromDate(date)
    implicit def timeToJavaDate(time: Time):java.util.Date = time.toDate
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy