Kotlinx.coroutines: java.time support for Flow

Created on 1 May 2019  路  6Comments  路  Source: Kotlin/kotlinx.coroutines

Consider to overload Flow operators with milliseconds parameters using Duration instead.

flow

Most helpful comment

All you've done is emphasize my criticisms.

All 6 comments

Why you so like java.time? Why not just Longs? Android has problems with this package

Android doesnnot have problems with it. They're only available on certain API levels, similar to most of the APIs that are exposed.

Longs are in general terrible types for representing anything since it carries no semantic information. Nothing prevents you from adding milliseconds to seconds and interpreting it as hours.

They're only available on certain API levels

Equals to

Android has problems with this package

Coroutines should work everywhere without limiting its support to android users.
Longs looks good when they used like:
10 * 1000 for seconds
10 * 60 * 1000 for minutes
10 * 60 * 60 * 1000 for hours, etc.
No problem with a speed and understanding.

All you've done is emphasize my criticisms.

We're working on adding durations support to Kotlin stdlib and we will support Kotlin duration types in coroutines library when they become available. There is no plan to direcly support Java's durations, but eventually there will be converters.

It was fixed by #1834

Was this page helpful?
0 / 5 - 0 ratings