SHARE
TWEET

Untitled

a guest Jan 20th, 2020 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*Time handling */
  2.   void _getCurrentTime() {
  3.     var timeNowToCompare;
  4.     var timeCompared;
  5.  
  6.     setState(() {
  7.       _timeNow = DateTime.now();
  8.       timeNowToCompare = _timeNow.millisecondsSinceEpoch;
  9.       //   print('Time now: $timeNowToCompare');
  10.  
  11.       _timeNow = Jiffy().format("EEE, MMM dd, kk:mm");
  12.  
  13. /*Set delayed time to show 30 min steps */
  14.       var date = DateTime.now();
  15.       var newDate = new DateTime(
  16.           date.year,
  17.           date.month,
  18.           date.day,
  19.           date.hour,
  20.           date.minute + 30,
  21.           date.second,
  22.           date.millisecond); //add 30 min to the current time
  23.       timeCompared = newDate.millisecondsSinceEpoch;
  24.       //  print('Delayed time: $timeCompared');
  25.     });
  26.  
  27. /*COMPARE CURRENT TIME WITH THE DELAYED ONE */
  28.     int i = timeNowToCompare;
  29.     while (i <= timeCompared) {
  30.       if (i % 1800000 == 0) {
  31.         //30 min in milliseconds
  32.  
  33.         //    print('30 min delayed: $i');
  34.         _timeDelay = i;
  35.         _timeDelay = DateTime.fromMillisecondsSinceEpoch(_timeDelay);
  36.         _timeDelay = Jiffy(_timeDelay).format("kk:mm");
  37.         //    print(_timeDelay);
  38.       }
  39.       i++;
  40.     }
  41.   }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top