mirror of
				https://gitlab.freedesktop.org/wayland/wayland.git
				synced 2025-11-03 09:01:42 -05:00 
			
		
		
		
	Fix event loop timer update.
It can now handle delays greater than 2 seconds without overflowing.
This commit is contained in:
		
							parent
							
								
									6d22c1bdc7
								
							
						
					
					
						commit
						0ae92f9706
					
				
					 1 changed files with 2 additions and 2 deletions
				
			
		| 
						 | 
					@ -231,8 +231,8 @@ wl_event_source_timer_update(struct wl_event_source *source, int ms_delay)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	its.it_interval.tv_sec = 0;
 | 
						its.it_interval.tv_sec = 0;
 | 
				
			||||||
	its.it_interval.tv_nsec = 0;
 | 
						its.it_interval.tv_nsec = 0;
 | 
				
			||||||
	its.it_value.tv_sec = 0;
 | 
						its.it_value.tv_sec = ms_delay / 1000;
 | 
				
			||||||
	its.it_value.tv_nsec = ms_delay * 1000 * 1000;
 | 
						its.it_value.tv_nsec = (ms_delay % 1000) * 1000 * 1000;
 | 
				
			||||||
	if (timerfd_settime(timer_source->fd, 0, &its, NULL) < 0) {
 | 
						if (timerfd_settime(timer_source->fd, 0, &its, NULL) < 0) {
 | 
				
			||||||
		fprintf(stderr, "could not set timerfd\n: %m");
 | 
							fprintf(stderr, "could not set timerfd\n: %m");
 | 
				
			||||||
		return -1;
 | 
							return -1;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue