File tree Expand file tree Collapse file tree 2 files changed +26
-2
lines changed
src/unix/linux_like/emscripten Expand file tree Collapse file tree 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;
88// make sure to add it to this list as well.
99const ALLOWED_CFGS : & ' static [ & ' static str ] = & [
1010 "emscripten_new_stat_abi" ,
11+ "emscripten_64_bit_time_t" ,
1112 "freebsd10" ,
1213 "freebsd11" ,
1314 "freebsd12" ,
@@ -56,7 +57,13 @@ fn main() {
5657 }
5758
5859 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+ }
6067 // Non-Emscripten or version < 3.1.42.
6168 Some ( _) | None => ( ) ,
6269 }
Original file line number Diff line number Diff line change @@ -16,7 +16,24 @@ pub type loff_t = i64;
1616pub type pthread_key_t = :: c_uint ;
1717
1818pub 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+
2037pub type suseconds_t = c_long ;
2138pub type ino_t = u64 ;
2239pub type off_t = i64 ;
You can’t perform that action at this time.
0 commit comments