@@ -10,7 +10,7 @@ use crate::*;
10
10
fn get_time < ' tcx > ( ) -> InterpResult < ' tcx , Duration > {
11
11
SystemTime :: now ( )
12
12
. duration_since ( SystemTime :: UNIX_EPOCH )
13
- . map_err ( |_| err_unsup_format ! ( "Time went backwards " ) . into ( ) )
13
+ . map_err ( |_| err_unsup_format ! ( "Times before the Unix epoch are not supported " ) . into ( ) )
14
14
}
15
15
16
16
fn int_to_immty_checked < ' tcx > (
@@ -52,7 +52,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
52
52
return Ok ( -1 ) ;
53
53
}
54
54
55
- let tp = this. force_ptr ( this . read_scalar ( tp_op) ? . not_undef ( ) ? ) ?;
55
+ let tp = this. deref_operand ( tp_op) ?;
56
56
57
57
let duration = get_time ( ) ?;
58
58
let tv_sec = duration. as_secs ( ) as i128 ;
@@ -63,11 +63,11 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
63
63
int_to_immty_checked ( tv_nsec, this. libc_ty_layout ( "c_long" ) ?) ?,
64
64
] ;
65
65
66
- this. write_immediates ( & tp, & imms) ?;
66
+ this. write_packed_immediates ( & tp, & imms) ?;
67
67
68
68
Ok ( 0 )
69
69
}
70
- // Foreign function used by generic unix
70
+ // Foreign function used by generic unix (in particular macOS)
71
71
fn gettimeofday (
72
72
& mut self ,
73
73
tv_op : OpTy < ' tcx , Tag > ,
@@ -86,7 +86,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
86
86
return Ok ( -1 ) ;
87
87
}
88
88
89
- let tv = this. force_ptr ( this . read_scalar ( tv_op) ? . not_undef ( ) ? ) ?;
89
+ let tv = this. deref_operand ( tv_op) ?;
90
90
91
91
let duration = get_time ( ) ?;
92
92
let tv_sec = duration. as_secs ( ) as i128 ;
@@ -97,7 +97,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
97
97
int_to_immty_checked ( tv_usec, this. libc_ty_layout ( "suseconds_t" ) ?) ?,
98
98
] ;
99
99
100
- this. write_immediates ( & tv, & imms) ?;
100
+ this. write_packed_immediates ( & tv, & imms) ?;
101
101
102
102
Ok ( 0 )
103
103
}
0 commit comments