Skip to content

GameTime.get_wallclocktime() should return a datetime object#1110

Open
Daraan wants to merge 5 commits intocarla-simulator:masterfrom
Daraan:unify-time-type
Open

GameTime.get_wallclocktime() should return a datetime object#1110
Daraan wants to merge 5 commits intocarla-simulator:masterfrom
Daraan:unify-time-type

Conversation

@Daraan
Copy link
Contributor

@Daraan Daraan commented Aug 27, 2024

Description

When using self.wallclock_t0 = GameTime.get_wallclocktime(), which returns _platform_timestamp a type-checker complains that the type used afterwards is int | datetime.datetime, however it is never used as int this is just the intial value. This minimal PR unifies the type to be always a datetime object.

- _platform_timestamp = 0
+ _platform_timestamp = datetime.datetime.fromtimestamp(0)

Where has this been tested?

  • Platform(s): Ubuntu 22.04
  • Python version(s): 3.7 & 3.10
  • Unreal Engine version(s):
  • CARLA version: 0.9.15 dev

Possible Drawbacks


This change is Reviewable

@Daraan Daraan changed the title timestamp is always datetime GameTime.get_wallclocktime() should return a datetime object Aug 27, 2024
@Daraan
Copy link
Contributor Author

Daraan commented Dec 30, 2025

Hey @glopezdiest can we add this. For pyright (and other type checkers that implicitly pick up types) users it will reduce some warnings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant