Skip to content

When timezone changes, DateTime.now() doesn't pick up on it. (Linux) #61303

@JesseRiemens

Description

@JesseRiemens

On Linux, on time zone change, Dart doesn't seem to update the new timezone. See my log output:

❯ dart run ./bin/timezone_test.dart 
From DateTime.now():    Current time: 2025-08-13 10:23:13.218415        Timezone: BST   Offset: 1:00:00.000000
Successfully set timezone to UTC
From DBus: Current timezone: UTC
From DateTime.now():    Current time: 2025-08-13 10:23:18.228321        Timezone: BST   Offset: 1:00:00.000000
From DateTime.now():    Current time: 2025-08-13 10:23:23.229198        Timezone: BST   Offset: 1:00:00.000000
Successfully set timezone to America/New_York
From DBus: Current timezone: America/New_York
From DateTime.now():    Current time: 2025-08-13 10:23:28.230512        Timezone: BST   Offset: 1:00:00.000000
From DateTime.now():    Current time: 2025-08-13 10:23:33.231413        Timezone: BST   Offset: 1:00:00.000000
Successfully set timezone to Europe/London
From DBus: Current timezone: Europe/London
From DateTime.now():    Current time: 2025-08-13 10:23:38.232312        Timezone: BST   Offset: 1:00:00.000000
From DateTime.now():    Current time: 2025-08-13 10:23:43.233544        Timezone: BST   Offset: 1:00:00.000000
Successfully set timezone to Asia/Tokyo
From DBus: Current timezone: Asia/Tokyo
From DateTime.now():    Current time: 2025-08-13 10:23:48.234469        Timezone: BST   Offset: 1:00:00.000000
From DateTime.now():    Current time: 2025-08-13 10:23:53.235222        Timezone: BST   Offset: 1:00:00.000000

I posted a MWE here: https://github.com/JesseRiemens/dart_timezone_bug_mwe

This seems related to ticket #53276
Commit 6027bcb fixed this, but was reverted due to issues on Android.

I think the fix for linux in that commit still works for linux however. My PR for this: #61302

My dart info output:

dart info

If providing this information as part of reporting a bug, please review the information
below to ensure it only contains things you're comfortable posting publicly.

#### General info

- Dart 3.8.1 (stable) (Wed May 28 00:47:25 2025 -0700) on "linux_x64"
- on linux / Linux 6.14.0-27-generic #27~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 17:38:49 UTC 2
- locale is en_US.UTF-8

#### Project info

- sdk constraint: '^3.8.1'
- dependencies: dbus
- dev_dependencies: lints, test

#### Process info

|  Memory |  CPU | Elapsed time | Command line                                                                     |
| ------: | ---: | -----------: | -------------------------------------------------------------------------------- |
|   57 MB | 0.0% |   1-00:03:25 | dart devtools --machine --allow-embedding --dtd-uri ws:<path>/1EKmYrbmJ5M=       |
|   60 MB | 0.0% |     22:43:12 | dart devtools --machine --allow-embedding --dtd-uri ws:<path>/aLzLjIBi7ok=       |
|   64 MB | 0.0% |     22:41:05 | dart devtools --machine --allow-embedding --dtd-uri ws:<path>/rQmXzwgub9GuDajD   |
|  384 MB | 0.0% |   1-00:03:25 | dart language-server --protocol=lsp --client-id=VS-Code --client-version=3.116.0 |
|  325 MB | 0.0% |     22:43:13 | dart language-server --protocol=lsp --client-id=VS-Code --client-version=3.116.0 |
| 1049 MB | 0.0% |     22:41:11 | dart language-server --protocol=lsp --client-id=VS-Code --client-version=3.116.0 |
|  406 MB | 0.0% |     22:37:27 | dart language-server --protocol=lsp --client-id=VS-Code --client-version=3.116.0 |
|   83 MB | 0.0% |     22:41:11 | dart tooling-daemon --machine                                                    |
|   66 MB | 0.0% |   1-00:03:25 | flutter_tools.snapshot daemon                                                    |
|   77 MB | 0.0% |     22:43:13 | flutter_tools.snapshot daemon                                                    |
|   77 MB | 0.0% |     22:41:11 | flutter_tools.snapshot daemon                                                    |

This bug breaks our embedded flutter app since it is the timezone interface for our OS, but it can't show the updated time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions