Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*Time handling */
- void _getCurrentTime() {
- var timeNowToCompare;
- var timeCompared;
- setState(() {
- _timeNow = DateTime.now();
- timeNowToCompare = _timeNow.millisecondsSinceEpoch;
- // print('Time now: $timeNowToCompare');
- _timeNow = Jiffy().format("EEE, MMM dd, kk:mm");
- /*Set delayed time to show 30 min steps */
- var date = DateTime.now();
- var newDate = new DateTime(
- date.year,
- date.month,
- date.day,
- date.hour,
- date.minute + 30,
- date.second,
- date.millisecond); //add 30 min to the current time
- timeCompared = newDate.millisecondsSinceEpoch;
- // print('Delayed time: $timeCompared');
- });
- /*COMPARE CURRENT TIME WITH THE DELAYED ONE */
- int i = timeNowToCompare;
- while (i <= timeCompared) {
- if (i % 1800000 == 0) {
- //30 min in milliseconds
- // print('30 min delayed: $i');
- _timeDelay = i;
- _timeDelay = DateTime.fromMillisecondsSinceEpoch(_timeDelay);
- _timeDelay = Jiffy(_timeDelay).format("kk:mm");
- // print(_timeDelay);
- }
- i++;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement