question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Session time is incorrect due to Time Zone change.

See original GitHub issue

Overview (Required)

The reproduction procedure is as follows.

  1. Visit Settings app. 1-1) Data & time > Set Time zone to London. (GMT+00:00) 1-2) Perform CLEAR DATA of droidkaigi2018 app.
  2. Launch droidkaigi2018 app. (Sessions will be displayed soon.)
  3. Finish app. (Back button)
  4. Visit Settings app. 4-1) Data & time > Set Time zone to Tokyo. (GMT+09:00)
  5. Launch droidkaigi2018 app. (The time of the displayed session is incorrect.)

sessiontimeincorrect

As an impression that I read the code, the following code has doubts.

LocalDateTimeAdapter.kt

private val FORMATTER: DateTimeFormatter =
        DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss")
fun parseDateString(dateString: String?): LocalDateTime =
        LocalDateTime.parse(dateString, FORMATTER)

I guess that the time obtained from the server is based on Japan time. However, the application is parsing according to current Time Zone set for the terminal?

Links

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
nukka123commented, Jan 20, 2018

@takahirom

Ok. I send PR! #371

1reaction
nukka123commented, Jan 20, 2018

@takahirom

I will introduce the code that I was verifying locally.

It is necessary to assume that the time expressed by LocalDateTime is JST.

fun LocalDateTime.toUnixMills(): Long = atZone(ZoneId.of("JST", ZoneId.SHORT_IDS))
        .toInstant().toEpochMilli()
    fun fromTimestamp(value: Long?): LocalDateTime? {
        if (value == null) {
            return null
        }
        return LocalDateTime.ofInstant(
                Instant.ofEpochSecond(value), ZoneId.of("JST", ZoneId.SHORT_IDS))
    }

Also, we should write javadoc about the time zone assumed by LocalDateTime.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is the time zone for my Calendar or scheduled Sessions ...
Why is the time zone for my Calendar or scheduled Sessions incorrect? · 1. From any page, click your profile photo in the...
Read more >
Sessions Display Wrong Times - Handshake Help Center
If unexpected start times are displayed or you're missing upcoming sessions, you may need to update your computer's timezone.
Read more >
Time zone automatically switches to wrong time zone
I am running Office 2010 Pro Plus on a Server 2008 R2 remote desktop services (terminal server) server. We are in the "(UTC-5:00)...
Read more >
Clock displaying incorrect timezone? - Help Center
Right-click on the time in the bottom-right of your screen and select Adjust Date/Time. A window will open. On the left side of...
Read more >
Troubleshooting Client Time Zone Issues
The clock indicates the clients' time zone. Verify the time zone setting on the server and workstation (not the clock time).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found