forked from quickshell/quickshell
		
	core/clock: fix breakage at midnight
The difference between 23:59 and 00:00 is -23:59, not 00:01.
This commit is contained in:
		
							parent
							
								
									76744c903a
								
							
						
					
					
						commit
						a4903eaefc
					
				
					 1 changed files with 5 additions and 1 deletions
				
			
		| 
						 | 
					@ -55,7 +55,11 @@ void SystemClock::update() {
 | 
				
			||||||
		else if (minutePrecision) nextTime = nextTime.addSecs(60);
 | 
							else if (minutePrecision) nextTime = nextTime.addSecs(60);
 | 
				
			||||||
		else if (hourPrecision) nextTime = nextTime.addSecs(3600);
 | 
							else if (hourPrecision) nextTime = nextTime.addSecs(3600);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		this->timer.start(time.msecsTo(nextTime));
 | 
							auto delay = time.msecsTo(nextTime);
 | 
				
			||||||
 | 
							// day rollover
 | 
				
			||||||
 | 
							if (delay < 0) delay += 86400000;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							this->timer.start(delay);
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		this->timer.stop();
 | 
							this->timer.stop();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue