time: fix compilation on macos
							parent
							
								
									3ea9868d0e
								
							
						
					
					
						commit
						cc8948efcf
					
				| 
						 | 
					@ -5,6 +5,8 @@ module time
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <time.h>
 | 
					#include <time.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					type time_t = i64
 | 
				
			||||||
 | 
					
 | 
				
			||||||
pub const (
 | 
					pub const (
 | 
				
			||||||
	days_string        = 'MonTueWedThuFriSatSun'
 | 
						days_string        = 'MonTueWedThuFriSatSun'
 | 
				
			||||||
	month_days         = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
 | 
						month_days         = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -67,7 +67,8 @@ fn darwin_now() Time {
 | 
				
			||||||
	tv := C.timeval{}
 | 
						tv := C.timeval{}
 | 
				
			||||||
	C.gettimeofday(&tv, 0)
 | 
						C.gettimeofday(&tv, 0)
 | 
				
			||||||
	loc_tm := C.tm{}
 | 
						loc_tm := C.tm{}
 | 
				
			||||||
	C.localtime_r(&tv.tv_sec, &loc_tm)
 | 
						asec := voidptr(&tv.tv_sec)
 | 
				
			||||||
 | 
						C.localtime_r(&time_t(asec), &loc_tm)
 | 
				
			||||||
	return convert_ctime(loc_tm, int(tv.tv_usec))
 | 
						return convert_ctime(loc_tm, int(tv.tv_usec))
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -34,8 +34,6 @@ pub fn (t Time) local() Time {
 | 
				
			||||||
	return convert_ctime(loc_tm, t.microsecond)
 | 
						return convert_ctime(loc_tm, t.microsecond)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type time_t = i64
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// in most systems, these are __quad_t, which is an i64
 | 
					// in most systems, these are __quad_t, which is an i64
 | 
				
			||||||
struct C.timespec {
 | 
					struct C.timespec {
 | 
				
			||||||
mut:
 | 
					mut:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue