# Datetime API: No atomic way to get "aware" current local datetime when moving between time zones

**URL:** <https://discuss.python.org/t/datetime-api-no-atomic-way-to-get-aware-current-local-datetime-when-moving-between-time-zones/55041>\
**Category:** Python Help\
**Created:** [June 5, 2024, 9:22pm UTC](https://discuss.python.org/t/datetime-api-no-atomic-way-to-get-aware-current-local-datetime-when-moving-between-time-zones/55041 "2024-06-05T21:22:56Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![rohanpadhye](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/rohanpadhye/32/20281_2.png) [@rohanpadhye](https://discuss.python.org/u/rohanpadhye)\
**Post date:** [June 6, 2024, 1:37am UTC](https://discuss.python.org/t/datetime-api-no-atomic-way-to-get-aware-current-local-datetime-when-moving-between-time-zones/55041/9 "2024-06-06T01:37:23Z")

</div>

> [@JamesParrott](#):
>
> I’m impressed by the amount of effort you’ve put in to this. If there’s a straightforward solution then fantastic.

Thanks. I think one simple solution would be to support something like `datetime.now(tz=timezone.local)`, where `timezone.local` is not an actual `tzinfo` instance but rather a sentinel value that tells `now()` that we want an aware instance of current local time (this also avoids [having `tzinfo` objects that change their behavior depending on location](https://blog.ganssle.io/articles/2022/04/naive-local-datetimes.html#:~:text=it%27s%20possible%20to%20change%20your%20system%20local%20time%20zone%20during%20the%20run%20of%20a%20Python%20program%2C%20and%20datetime%20objects%20are%20not%20designed%20to%20allow%20tzinfo%20objects%20to%20return%20different%20offsets%20at%20different%20points%20in%20their%20lifespan), as  
@pganssle has written about). This would produce the same behavior as `now(tz=None)` followed by `astimezone()`, except it would not require querying the system local time multiple times.

Edit: I just came across a [similar discussion topic](https://discuss.python.org/t/get-now-with-local-system-timezone-without-knowing-the-timezone-first/22665) which proposed the same API improvement but without going into the problems associated with moving across time zones. I don’t know if it is possible to link discussions (apologies, I’m new here).

---

_[View the full topic](https://discuss.python.org/t/datetime-api-no-atomic-way-to-get-aware-current-local-datetime-when-moving-between-time-zones/55041)._
