Let a timer still run if the game is closed

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Godot_Starter

If I make a game in with you build a town, for example, and I build a new house, how can I make that the timer, which says how long it takes until the house is build, still runs when the game is closed or the PC is turned of? For example, if I build the house at seven o clock and it takes 3 houres, it have to be finished at ten o clock, also if the user dont play the game the whole time.

PS: Sorry for bad english and for the confusing title

:bust_in_silhouette: Reply From: NikhilKadiyan

I do not think you can run a timer while the application is closed(If someone can correct me I will be grateful).
But OS — Godot Engine (stable) documentation in English comes to your rescue. You can store the date in a file when you close the game. Then the next time you start the game, again query OS.get_datetime and subtract the last saved time from it.