File tree 2 files changed +26
-2
lines changed
src/unix/linux_like/emscripten
2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ use std::string::String;
8
8
// make sure to add it to this list as well.
9
9
const ALLOWED_CFGS : & ' static [ & ' static str ] = & [
10
10
"emscripten_new_stat_abi" ,
11
+ "emscripten_64_bit_time_t" ,
11
12
"freebsd10" ,
12
13
"freebsd11" ,
13
14
"freebsd12" ,
@@ -56,7 +57,13 @@ fn main() {
56
57
}
57
58
58
59
match emcc_version_code ( ) {
59
- Some ( v) if ( v >= 30142 ) => set_cfg ( "emscripten_new_stat_abi" ) ,
60
+ Some ( v) if ( v >= 30142 ) => {
61
+ set_cfg ( "emscripten_new_stat_abi" ) ;
62
+ set_cfg ( "emscripten_64_bit_time_t" ) ;
63
+ }
64
+ Some ( v) if ( v >= 30116 ) => {
65
+ set_cfg ( "emscripten_64_bit_time_t" ) ;
66
+ }
60
67
// Non-Emscripten or version < 3.1.42.
61
68
Some ( _) | None => ( ) ,
62
69
}
Original file line number Diff line number Diff line change @@ -16,7 +16,24 @@ pub type loff_t = i64;
16
16
pub type pthread_key_t = :: c_uint ;
17
17
18
18
pub type clock_t = c_long ;
19
- pub type time_t = c_long ;
19
+
20
+ // time_t was type:
21
+ //
22
+ // - long from v1.5.4 (2013/08/08) until v3.1.11
23
+ // - int from v3.1.11 (2022/05/20) until v3.1.16
24
+ // - _Int64 from v3.1.16 (2022/07/14)
25
+ //
26
+ // And it's still int64 today. The change from long to int was marked as a
27
+ // nonfunctional change since wasm64 was considered to be not working yet in
28
+ // v3.1.11. So it suffices to say it's 32 bit until v3.1.16 and 64 bit after.
29
+ cfg_if ! {
30
+ if #[ cfg( emscripten_64_bit_time_t) ] {
31
+ pub type time_t = i64 ;
32
+ } else {
33
+ pub type time_t = i32 ;
34
+ }
35
+ }
36
+
20
37
pub type suseconds_t = c_long ;
21
38
pub type ino_t = u64 ;
22
39
pub type off_t = i64 ;
You can’t perform that action at this time.
0 commit comments