Calculate date?

how can i complete this?
There is for exmple a build and the building time is 30 min. When i close the game and open it again after 30min. how will be the building time 30min? I hope you understand my question.

The easiest way to do this is to save the start or due date for a construction. Then after loading the game for the next time just compare the date.

The user starts construction at 13:30 of a building taking 30min to complete. What you now remember and save is that the building is due at 14:00.
After loading your game you just put a if(DateTime.Now > DueDate) into wherever you want to check if the building has been completed.

More advanced topics to think about:

  • Differences in timezones / daylight saving times
  • Popular method of changing the local computer time to “cheat” this kind of games
  • Change in balancing: What happens if the construction time changes because you rebalanced the game while it was not running.