File tree Expand file tree Collapse file tree 5 files changed +42
-0
lines changed Expand file tree Collapse file tree 5 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,7 @@ fn main() {
82
82
83
83
if android {
84
84
cfg. header ( "arpa/inet.h" ) ;
85
+ cfg. header ( "time64.h" ) ;
85
86
} else if !windows {
86
87
cfg. header ( "glob.h" ) ;
87
88
cfg. header ( "ifaddrs.h" ) ;
@@ -232,6 +233,10 @@ fn main() {
232
233
"dlerror" if android => true , // const-ness is added
233
234
"dladdr" if musl => true , // const-ness only added recently
234
235
236
+ // OSX has 'struct tm *const' which we can't actually represent in
237
+ // Rust, but is close enough to *mut
238
+ "timegm" if apple => true ,
239
+
235
240
_ => false ,
236
241
}
237
242
} ) ;
Original file line number Diff line number Diff line change 66
66
pub struct fd_set {
67
67
fds_bits: [ i32 ; FD_SETSIZE / 32 ] ,
68
68
}
69
+
70
+ pub struct tm {
71
+ pub tm_sec: :: c_int,
72
+ pub tm_min: :: c_int,
73
+ pub tm_hour: :: c_int,
74
+ pub tm_mday: :: c_int,
75
+ pub tm_mon: :: c_int,
76
+ pub tm_year: :: c_int,
77
+ pub tm_wday: :: c_int,
78
+ pub tm_yday: :: c_int,
79
+ pub tm_isdst: :: c_int,
80
+ pub tm_gmtoff: :: c_long,
81
+ pub tm_zone: * mut :: c_char,
82
+ }
69
83
}
70
84
71
85
pub const FIOCLEX : :: c_ulong = 0x20006601 ;
Original file line number Diff line number Diff line change @@ -450,6 +450,12 @@ extern {
450
450
res : * mut * mut addrinfo ) -> :: c_int ;
451
451
pub fn freeaddrinfo ( res : * mut addrinfo ) ;
452
452
pub fn gai_strerror ( errcode : :: c_int ) -> * const :: c_char ;
453
+
454
+ pub fn gmtime_r ( time_p : * const time_t , result : * mut tm ) -> * mut tm ;
455
+ pub fn localtime_r ( time_p : * const time_t , result : * mut tm ) -> * mut tm ;
456
+ #[ cfg_attr( all( target_os = "macos" , target_arch = "x86" ) ,
457
+ link_name = "mktime$UNIX2003" ) ]
458
+ pub fn mktime ( tm : * mut tm ) -> time_t ;
453
459
}
454
460
455
461
// TODO: get rid of this #[cfg(not(...))]
@@ -551,6 +557,7 @@ extern {
551
557
offset : :: off_t ,
552
558
whence : :: c_int ) -> :: c_int ;
553
559
pub fn ftello ( stream : * mut :: FILE ) -> :: off_t ;
560
+ pub fn timegm ( tm : * mut :: tm ) -> time_t ;
554
561
}
555
562
556
563
cfg_if ! {
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ pub type socklen_t = i32;
19
19
pub type pthread_t = c_long ;
20
20
pub type pthread_mutexattr_t = :: c_long ;
21
21
pub type sigset_t = c_ulong ;
22
+ pub type time64_t = i64 ;
22
23
23
24
s ! {
24
25
pub struct stat {
@@ -225,6 +226,7 @@ extern {
225
226
serv : * mut :: c_char ,
226
227
sevlen : :: size_t ,
227
228
flags : :: c_int ) -> :: c_int ;
229
+ pub fn timegm64 ( tm : * const :: tm ) -> time64_t ;
228
230
}
229
231
230
232
cfg_if ! {
Original file line number Diff line number Diff line change 72
72
pub struct fd_set {
73
73
fds_bits: [ :: c_ulong; FD_SETSIZE / ULONG_SIZE ] ,
74
74
}
75
+
76
+ pub struct tm {
77
+ pub tm_sec: :: c_int,
78
+ pub tm_min: :: c_int,
79
+ pub tm_hour: :: c_int,
80
+ pub tm_mday: :: c_int,
81
+ pub tm_mon: :: c_int,
82
+ pub tm_year: :: c_int,
83
+ pub tm_wday: :: c_int,
84
+ pub tm_yday: :: c_int,
85
+ pub tm_isdst: :: c_int,
86
+ pub tm_gmtoff: :: c_long,
87
+ pub tm_zone: * const :: c_char,
88
+ }
75
89
}
76
90
77
91
// intentionally not public, only used for fd_set
You can’t perform that action at this time.
0 commit comments