How would I go about creating an in game time system?

Hi there. I’m making a 2d rpg game. I plan to rely heavily on a in game time system. But, I’m fairly new to unity and coding and need a push in the right direction.

For reference, I’m trying to do a system similar to the time system in Stardew Valley.

Any help on how to get started would be much appreciated!

There is two ways you could go about it:
You can base it on the system clock, or you can base it on one of the two delta times (probably fixed as you don’t want to be calculating this every frame needlessly).
I would recommend though the system clock. Assuming you go with that, whenever you want to start time running, you record the real time from the system close (DateTime.Now()) and your start game time. You then, whenever you need to know the current time, you subtract the current time from this recorded start time to get a timespan. Then, you multiply that by some factor (say 60 for every second of real time being 1 minute in game time). Add that to your start game time and you got your current game time. If you need to pause time, you just record your current game time, wait till it starts up again, and begin the process again.