mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Microseconds in log time.
This commit is contained in:
		
							
								
								
									
										7
									
								
								log.c
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								log.c
									
									
									
									
									
								
							@@ -67,13 +67,14 @@ void
 | 
			
		||||
log_vwrite(const char *msg, va_list ap)
 | 
			
		||||
{
 | 
			
		||||
	char		*fmt;
 | 
			
		||||
	time_t	 t;
 | 
			
		||||
	struct timeval	 tv;
 | 
			
		||||
 | 
			
		||||
	if (log_file == NULL)
 | 
			
		||||
		return;
 | 
			
		||||
 | 
			
		||||
	t = time(NULL);
 | 
			
		||||
	if (asprintf(&fmt, "%lld %s\n", (long long)t, msg) == -1)
 | 
			
		||||
	gettimeofday(&tv, NULL);
 | 
			
		||||
	if (asprintf(&fmt, "%lld.%06d %s\n", (long long)tv.tv_sec,
 | 
			
		||||
	    (int)tv.tv_usec, msg) == -1)
 | 
			
		||||
		exit(1);
 | 
			
		||||
	if (vfprintf(log_file, fmt, ap) == -1)
 | 
			
		||||
		exit(1);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user