Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.

Commit

Permalink
Fix: use timezone properly
Browse files Browse the repository at this point in the history
  • Loading branch information
igrep committed Feb 24, 2019
1 parent b34d8b2 commit 8491890
Showing 1 changed file with 7 additions and 1 deletion.
Expand Up @@ -17,11 +17,17 @@ class ContributionStatusChecker(

val beginningOfToday = Calendar.getInstance(Locale("ja", "JP", "JP")).run {
time = getCurrentTime(Unit)
timeZone = TimeZone.getTimeZone("JST")
val jst = TimeZone.getTimeZone("Asia/Tokyo")
timeZone = jst
set(Calendar.HOUR_OF_DAY, 0)
set(Calendar.MINUTE, 0)
set(Calendar.SECOND, 0)
set(Calendar.MILLISECOND, 0)
val jstTimeInMillis = time.time
val utc = TimeZone.getTimeZone("UTC")
timeZone = utc
val offset = utc.getOffset(jstTimeInMillis)
timeInMillis = jstTimeInMillis + offset
time
}

Expand Down

0 comments on commit 8491890

Please sign in to comment.