fix tzset cbindgen declarations
This commit is contained in:
@@ -66,7 +66,7 @@ static mut ASCTIME: [c_char; 26] = [0; 26];
|
||||
|
||||
// We don't handle timezones, so just initialize the timezone info to GMT
|
||||
// TODO: timezones
|
||||
#[repr(C)]
|
||||
#[repr(transparent)]
|
||||
pub struct TzName {
|
||||
tz: [*const c_char; 2],
|
||||
}
|
||||
@@ -75,13 +75,13 @@ unsafe impl Sync for TzName {}
|
||||
|
||||
#[allow(non_upper_case_globals)]
|
||||
#[no_mangle]
|
||||
pub static tzname: TzName = TzName { tz: [UTC, UTC] };
|
||||
pub static mut tzname: TzName = TzName { tz: [UTC, UTC] };
|
||||
#[allow(non_upper_case_globals)]
|
||||
#[no_mangle]
|
||||
pub static daylight: c_int = 0;
|
||||
pub static mut daylight: c_int = 0;
|
||||
#[allow(non_upper_case_globals)]
|
||||
#[no_mangle]
|
||||
pub static timezone: c_long = 0;
|
||||
pub static mut timezone: c_long = 0;
|
||||
|
||||
#[repr(C)]
|
||||
pub struct itimerspec {
|
||||
|
||||
@@ -84,6 +84,7 @@ EXPECT_NAMES=\
|
||||
time/mktime \
|
||||
time/strftime \
|
||||
time/time \
|
||||
time/tzset \
|
||||
tls \
|
||||
unistd/access \
|
||||
unistd/brk \
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
tzname[0] UTC, tzname[1] UTC, daylight 0, timezone 0
|
||||
@@ -0,0 +1,16 @@
|
||||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
extern int daylight;
|
||||
extern long timezone;
|
||||
extern const char *tzname[2];
|
||||
void tzset(void);
|
||||
|
||||
int main(void) {
|
||||
tzset();
|
||||
printf("tzname[0] %s, tzname[1] %s, daylight %d, timezone %ld\n",
|
||||
tzname[0], tzname[1], daylight, timezone);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user