public void DateTimeAmICrazy()
        {
            //var cp = new CheckPoint(DateTime.Now.AddHours(1));//1AM
            //Console.WriteLine(cp.CP);
            //Console.WriteLine(cp.Cycle.Id);
            //Console.WriteLine(cp.DateTime);
            //Console.WriteLine(cp.IsFirstMessageOfDay());
            //Console.WriteLine(cp.NextUnsnoozeTime());

            var cp = new CheckPoint(DateTime.UtcNow.AddHours(1)); //1AM
            Console.WriteLine(cp.CP);
            Console.WriteLine(cp.Cycle.Id);
            Console.WriteLine(cp.DateTime);
            Console.WriteLine(cp.IsFirstMessageOfDay());
            Console.WriteLine(cp.NextUnsnoozeTime());
        }
예제 #2
0
 public string NextUnsnoozeTime()
 {
     var dateTimeNow = DateTime;
     CheckPoint newCp;
     while (true)
     {
         dateTimeNow = dateTimeNow.AddHours(5);
         newCp = new CheckPoint(dateTimeNow);
         if (newCp.Cycle.Id != Cycle.Id)
         {
             break;
         }
         if (newCp.IsFirstMessageOfDay())
         {
             break;
         }
     }
     var easternZone = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");
     var easternTime = TimeZoneInfo.ConvertTimeFromUtc(newCp.DateTime, easternZone);
     return $"{easternTime.ToShortDateString()} {easternTime.ToShortTimeString()}";
 }