Skip to content
This repository was archived by the owner on Jul 8, 2022. It is now read-only.

Commit 7f8e630

Browse files
committed
Update README.md
1 parent c5975ee commit 7f8e630

File tree

2 files changed

+33
-9
lines changed

2 files changed

+33
-9
lines changed

README.md

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,31 @@ Consistent and portable date and time utilities for multiplatform kotlin (JVM, J
55
[![Build Status](https://travis-ci.org/korlibs/klock.svg?branch=master)](https://travis-ci.org/korlibs/klock)
66
[![Maven Version](https://img.shields.io/github/tag/korlibs/klock.svg?style=flat&label=maven)](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22klock%22)
77

8-
Use with gradle (uploaded to maven central):
8+
Use with gradle (uploaded to bintray and synchronized to jcenter):
99

1010
```
11-
compile "com.soywiz:klock:0.2.0" // jvm/android
12-
compile "com.soywiz:klock-js:0.2.0" // js
13-
compile "com.soywiz:klock-common:0.2.0" // common (just expect 2 decls in Klock)
11+
def klockVersion = "1.0.0-alpha-1"
12+
13+
repositories {
14+
maven { url "https://dl.bintray.com/soywiz/soywiz" }
15+
}
16+
17+
compile "com.soywiz:klock-jvm:$klockVersion" // JVM/Android
18+
compile "com.soywiz:klock-js:$klockVersion" // JavaScript
19+
compile "com.soywiz:klock-iosarm32:$klockVersion" // Older iOS devices
20+
compile "com.soywiz:klock-iosarm64:$klockVersion" // New iOS devices
21+
compile "com.soywiz:klock-iosx64:$klockVersion" // Simulator
22+
compile "com.soywiz:klock-linuxx64:$klockVersion" // Linux x64
23+
compile "com.soywiz:klock-macosx64:$klockVersion" // MacOS
24+
compile "com.soywiz:klock-mingwx64:$klockVersion" // Windows x64
25+
compile "com.soywiz:klock-common:$klockVersion" // Common (just expect 2 decls in Klock)
1426
```
1527

1628
```kotlin
1729
object Klock {
1830
fun currentTimeMillis(): Long
31+
fun currentTimeMillisDouble(): Double
32+
fun microClock(): Double
1933
fun getLocalTimezoneOffset(unix: Long): Int
2034
}
2135

@@ -38,13 +52,21 @@ enum class Month {
3852
fun daysToEnd(year: Int): Int
3953
}
4054

41-
object Year {
42-
fun isLeap(year: Int): Boolean
55+
inline class Year(val year: Int) : Comparable<Year> {
56+
companion object {
57+
fun checked(year: Int): Year
58+
fun isLeapChecked(year: Int): Boolean
59+
fun isLeap(year: Int): Boolean
60+
}
61+
62+
override fun compareTo(other: Year): Int
4363
}
4464

65+
4566
interface DateTime {
4667
companion object {
4768
val EPOCH: DateTime
69+
4870
operator fun invoke(year: Int, month: Int, day: Int, hour: Int = 0, minute: Int = 0, second: Int = 0, milliseconds: Int = 0): DateTime
4971
operator fun invoke(time: Long): DateTime
5072

@@ -106,7 +128,7 @@ data class TimeDistance(val years: Int = 0, val months: Int = 0, val days: Doubl
106128
operator fun times(times: Double): TimeDistance
107129
}
108130

109-
data class TimeSpan {
131+
inline class TimeSpan {
110132
val milliseconds: Int
111133
val seconds: Double
112134

@@ -131,7 +153,10 @@ inline val Number.milliseconds: TimeSpan
131153

132154
class SimplerDateFormat(val format: String) {
133155
companion object {
134-
val DEFAULT_FORMAT: SimplerDateFormat // "EEE, dd MMM yyyy HH:mm:ss z"
156+
val DEFAULT_FORMAT = SimplerDateFormat("EEE, dd MMM yyyy HH:mm:ss z")
157+
val FORMAT1 = SimplerDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX")
158+
val FORMATS = listOf(DEFAULT_FORMAT, FORMAT1)
159+
fun parse(str: String): DateTime
135160
}
136161

137162
fun format(date: Long): String

src/commonMain/kotlin/com/soywiz/klock/SimplerDateFormat.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.soywiz.klock
22

3-
43
class SimplerDateFormat(val format: String) {
54
companion object {
65
private val rx = Regex("('[\\w]+'|[\\w]+\\B[^Xx]|[Xx]{1,3}|[\\w]+)")

0 commit comments

Comments
 (0)