-
Notifications
You must be signed in to change notification settings - Fork 110
update: second text review #400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,7 @@ import kotlin.time.Duration.Companion.nanoseconds | |
* "two days and three hours". | ||
* [DatePeriod] is specifically a combination of [DateTimeUnit.DateBased] values. | ||
* [DateTimePeriod] is more flexible than [DateTimeUnit] because it can express a combination of values with different | ||
* kinds of units, but in exchange, the duration of time between two [Instant] or [LocalDate] values can be | ||
* kinds of units. However, in exchange, the duration of time between two [Instant] or [LocalDate] values can be | ||
* measured in terms of some [DateTimeUnit], but not [DateTimePeriod] or [DatePeriod]. | ||
* | ||
* ### Construction, serialization, and deserialization | ||
|
@@ -169,8 +169,8 @@ public sealed class DateTimeUnit { | |
* | ||
* The reason lies in time zone transitions, because of which some days can be 23 or 25 hours. | ||
* For example, we say that exactly a whole day has passed between `2019-10-27T02:59` and `2019-10-28T02:59` | ||
* in Berlin, despite the fact that the clocks were turned back one hour, so there are, in fact, 25 hours | ||
* between the two date-times. | ||
* in Berlin, even though the clocks were turned back one hour, so there are, in fact, 25 hours | ||
* between the two date/times. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've looked into it, and it seems like the proper form is "datetime" with no separators: https://en.wiktionary.org/wiki/datetime There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The problem I was trying to solve here is the inconsistency between There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it's very common for nouns to act as adjectives, modifying other nouns |
||
* | ||
* @see DateTimeUnit for a description of date-time units in general. | ||
* @sample kotlinx.datetime.test.samples.DateTimeUnitSamples.dayBasedUnit | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -15,7 +15,7 @@ import kotlin.time.* | |||||
/** | ||||||
* A moment in time. | ||||||
* | ||||||
* A point in time must be uniquely identified so that it is independent of a time zone. | ||||||
* A point in time must be uniquely identified to be independent of a time zone. | ||||||
danil-pavlov marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
* For example, `1970-01-01, 00:00:00` does not represent a moment in time since this would happen at different times | ||||||
* in different time zones: someone in Tokyo would think it is already `1970-01-01` several hours earlier than someone in | ||||||
* Berlin would. To represent such entities, use [LocalDateTime]. | ||||||
|
@@ -36,7 +36,7 @@ import kotlin.time.* | |||||
* ``` | ||||||
* | ||||||
* The [Clock.System] implementation uses the platform-specific system clock to obtain the current moment. | ||||||
* Note that this clock is not guaranteed to be monotonic, and it may be adjusted by the user or the system at any time, | ||||||
* Note that this clock is not guaranteed to be monotonic, and the user or the system may adjust it at any time, | ||||||
* so it should not be used for measuring time intervals. | ||||||
* For that, consider using [TimeSource.Monotonic] and [TimeMark] instead of [Clock.System] and [Instant]. | ||||||
* | ||||||
|
@@ -121,7 +121,7 @@ import kotlin.time.* | |||||
* // Two months, three days, four hours, and five minutes until the concert | ||||||
* ``` | ||||||
* | ||||||
* or [Instant.until] method, as well as [Instant.daysUntil], [Instant.monthsUntil], | ||||||
* Or the [Instant.until] method, as well as [Instant.daysUntil], [Instant.monthsUntil], | ||||||
* and [Instant.yearsUntil] extension functions: | ||||||
* | ||||||
* ``` | ||||||
|
@@ -223,7 +223,7 @@ public expect class Instant : Comparable<Instant> { | |||||
/** | ||||||
* Returns the number of milliseconds from the epoch instant `1970-01-01T00:00:00Z`. | ||||||
* | ||||||
* Any fractional part of millisecond is rounded toward zero to the whole number of milliseconds. | ||||||
* Any fractional part of a millisecond is rounded toward zero to the whole number of milliseconds. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "A" here means "any", not a particular millisecond There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, but it's not an "any" millisecond we're interested in but exactly the one used as the input of this function. EDIT: for example, see the first line of this KDoc: "the number of milliseconds." Not just a number of milliseconds, but the number of milliseconds corresponding to the input. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I disagree, the way it's written right now looks like a general rule, "Any fractional part of a millisecond is rounded toward zero" |
||||||
* | ||||||
* If the result does not fit in [Long], returns [Long.MAX_VALUE] for a positive result or [Long.MIN_VALUE] for a negative result. | ||||||
* | ||||||
|
@@ -362,13 +362,13 @@ public expect class Instant : Comparable<Instant> { | |||||
/** | ||||||
* A shortcut for calling [DateTimeFormat.parse], followed by [DateTimeComponents.toInstantUsingOffset]. | ||||||
* | ||||||
* Parses a string that represents an instant including date and time components and a mandatory | ||||||
* Parses a string that represents an instant, including date and time components and a mandatory | ||||||
* time zone offset and returns the parsed [Instant] value. | ||||||
* | ||||||
* The string is considered to represent time on the UTC-SLS time scale instead of UTC. | ||||||
* In practice, this means that, even if there is a leap second on the given day, it will not affect how the | ||||||
* time is parsed, even if it's in the last 1000 seconds of the day. | ||||||
* Instead, even if there is a negative leap second on the given day, 23:59:59 is still considered valid time. | ||||||
* Instead, even if there is a negative leap second on the given day, 23:59:59 is still considered a valid time. | ||||||
* 23:59:60 is invalid on UTC-SLS, so parsing it will fail. | ||||||
* | ||||||
* If the format is not specified, [DateTimeComponents.Formats.ISO_DATE_TIME_OFFSET] is used. | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,7 +108,7 @@ public expect open class TimeZone { | |
* Return the civil date/time value that this instant has in the time zone provided as an implicit receiver. | ||
* | ||
* Note that while this conversion is unambiguous, the inverse ([LocalDateTime.toInstant]) | ||
* is not necessary so. | ||
* is not necessarily so. | ||
* | ||
* @see LocalDateTime.toInstant | ||
* @see Instant.offsetIn | ||
|
@@ -121,12 +121,12 @@ public expect open class TimeZone { | |
* Returns an instant that corresponds to this civil date/time value in the time zone provided as an implicit receiver. | ||
* | ||
* Note that the conversion is not always well-defined. There can be the following possible situations: | ||
* - There's only one instant that has this date/time value in the [timeZone]. | ||
* - Only one instant has this date/time value in the [timeZone]. | ||
* In this case, the conversion is unambiguous. | ||
* - There's no instant that has this date/time value in the [timeZone]. | ||
* - No instant has this date/time value in the [timeZone]. | ||
* Such a situation appears when the time zone experiences a transition from a lesser to a greater offset. | ||
* In this case, the conversion is performed with the lesser (earlier) offset, as if the time gap didn't occur yet. | ||
* - There are two possible instants that can have this date/time components in the [timeZone]. | ||
* - Two possible instants can have these date/time components in the [timeZone]. | ||
* In this case, the earlier instant is returned. | ||
* | ||
* @see Instant.toLocalDateTime | ||
|
@@ -176,7 +176,7 @@ public typealias ZoneOffset = FixedOffsetTimeZone | |
/** | ||
* Finds the offset from UTC this time zone has at the specified [instant] of physical time. | ||
* | ||
* **Pitfall**: the offset returned from this function should typically not be used for datetime arithmetics, | ||
* **Pitfall**: the offset returned from this function should typically not be used for date/time arithmetics | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably https://en.wiktionary.org/wiki/date-time. Though I do see that this file contains the same choice of words already. Should probably be replaced to |
||
* because the offset can change over time due to daylight-saving-time transitions and other reasons. | ||
* Use [TimeZone] directly with arithmetic operations instead. | ||
* | ||
|
@@ -190,7 +190,7 @@ public expect fun TimeZone.offsetAt(instant: Instant): UtcOffset | |
* Returns a civil date/time value that this instant has in the specified [timeZone]. | ||
* | ||
* Note that while this conversion is unambiguous, the inverse ([LocalDateTime.toInstant]) | ||
* is not necessary so. | ||
* is not necessarily so. | ||
* | ||
* @see LocalDateTime.toInstant | ||
* @see Instant.offsetIn | ||
|
@@ -202,7 +202,7 @@ public expect fun Instant.toLocalDateTime(timeZone: TimeZone): LocalDateTime | |
/** | ||
* Returns a civil date/time value that this instant has in the specified [UTC offset][offset]. | ||
* | ||
* **Pitfall**: it is typically more robust to use [TimeZone] directly, because the offset can change over time due to | ||
* **Pitfall**: it is typically more robust to use [TimeZone] directly because the offset can change over time due to | ||
* daylight-saving-time transitions and other reasons, so [this] instant may actually correspond to a different offset | ||
* in the implied time zone. | ||
* | ||
|
@@ -215,7 +215,7 @@ internal expect fun Instant.toLocalDateTime(offset: UtcOffset): LocalDateTime | |
/** | ||
* Finds the offset from UTC the specified [timeZone] has at this instant of physical time. | ||
* | ||
* **Pitfall**: the offset returned from this function should typically not be used for datetime arithmetics, | ||
* **Pitfall**: the offset returned from this function should typically not be used for date/time arithmetics | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
* because the offset can change over time due to daylight-saving-time transitions and other reasons. | ||
* Use [TimeZone] directly with arithmetic operations instead. | ||
* | ||
|
@@ -230,12 +230,12 @@ public fun Instant.offsetIn(timeZone: TimeZone): UtcOffset = | |
* Returns an instant that corresponds to this civil date/time value in the specified [timeZone]. | ||
* | ||
* Note that the conversion is not always well-defined. There can be the following possible situations: | ||
* - There's only one instant that has this date/time value in the [timeZone]. | ||
* - Only one instant has this date/time value in the [timeZone]. | ||
* In this case, the conversion is unambiguous. | ||
* - There's no instant that has this date/time value in the [timeZone]. | ||
* - No instant has this date/time value in the [timeZone]. | ||
* Such a situation appears when the time zone experiences a transition from a lesser to a greater offset. | ||
* In this case, the conversion is performed with the lesser (earlier) offset, as if the time gap didn't occur yet. | ||
* - There are two possible instants that can have this date/time components in the [timeZone]. | ||
* - Two possible instants can have these date/time components in the [timeZone]. | ||
* In this case, the earlier instant is returned. | ||
* | ||
* @see Instant.toLocalDateTime | ||
|
@@ -255,8 +255,8 @@ public expect fun LocalDateTime.toInstant(offset: UtcOffset): Instant | |
* Returns an instant that corresponds to the start of this date in the specified [timeZone]. | ||
* | ||
* Note that it's not equivalent to `atTime(0, 0).toInstant(timeZone)` | ||
* because a day does not always start at the fixed time 00:00:00. | ||
* For example, if due do daylight saving time, clocks were shifted from 23:30 | ||
* because a day does not always start at a fixed time 00:00:00. | ||
* For example, if, due to daylight saving time, clocks were shifted from 23:30 | ||
* of one day directly to 00:30 of the next day, skipping the midnight, then | ||
* `atStartOfDayIn` would return the `Instant` corresponding to 00:30, whereas | ||
* `atTime(0, 0).toInstant(timeZone)` would return the `Instant` corresponding | ||
|
Uh oh!
There was an error while loading. Please reload this page.