I need help clicker game

Ok so for a while now i have been trying to make a clicker game while it has gone well i have run into one problem as in most clicker/idle games you make money while the game is closed now from what i can tell you do this by getting time that game was shutdown and time that game was reopened and subtract the two then multiply it by for ex. the goldpersecond you are getting but i can not figure out how to do this i have tryed many things but i need it to be in seconds

You are correct, you will want to serialize your shutdown time and compare the next open time, but this comes with some problems. (The user could easily change their system time) thus work around what you’re trying to do by “Hacking” in new times.

You can solve the first problem of checking the times by using a unadjustable time from a online source or your own server:

 public static DateTime GetNistTime()
 {
 DateTime dateTime = DateTime.MinValue;

 HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://nist.time.gov/actualtime.cgi?lzbc=siqm9b");
 request.Method = "GET";
 request.Accept = "text/html, application/xhtml+xml, */*";
 request.UserAgent = "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)";
 request.ContentType = "application/x-www-form-urlencoded";
 request.CachePolicy = new RequestCachePolicy(RequestCacheLevel.NoCacheNoStore); //No caching
 HttpWebResponse response = (HttpWebResponse)request.GetResponse();
 if (response.StatusCode == HttpStatusCode.OK)
 {
     StreamReader stream = new StreamReader(response.GetResponseStream());
     string html = stream.ReadToEnd();//<timestamp time=\"1395772696469995\" delay=\"1395772696469995\"/>
     string time = Regex.Match(html, @"(?<=\btime="")[^""]*").Value;
     double milliseconds = Convert.ToInt64(time) / 1000.0;
     dateTime = new DateTime(1970, 1, 1).AddMilliseconds(milliseconds).ToLocalTime();
 }
 //Returns the current time from an online source
 return dateTime;
 }

This script will return your date time so you can serialize it and also compare the current open time, if they don’t have internet you can just grab the system time (But the user can manually change it, think Fable)

But you’re going to have to find away that works best for you to make the serialized time un changeable (Your second problem).