@@ -10,7 +10,7 @@ use crate::*;
1010fn get_time < ' tcx > ( ) -> InterpResult < ' tcx , Duration > {
1111 SystemTime :: now ( )
1212 . 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 ( ) )
1414}
1515
1616fn int_to_immty_checked < ' tcx > (
@@ -52,7 +52,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
5252 return Ok ( -1 ) ;
5353 }
5454
55- let tp = this. force_ptr ( this . read_scalar ( tp_op) ? . not_undef ( ) ? ) ?;
55+ let tp = this. deref_operand ( tp_op) ?;
5656
5757 let duration = get_time ( ) ?;
5858 let tv_sec = duration. as_secs ( ) as i128 ;
@@ -63,11 +63,11 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
6363 int_to_immty_checked ( tv_nsec, this. libc_ty_layout ( "c_long" ) ?) ?,
6464 ] ;
6565
66- this. write_immediates ( & tp, & imms) ?;
66+ this. write_packed_immediates ( & tp, & imms) ?;
6767
6868 Ok ( 0 )
6969 }
70- // Foreign function used by generic unix
70+ // Foreign function used by generic unix (in particular macOS)
7171 fn gettimeofday (
7272 & mut self ,
7373 tv_op : OpTy < ' tcx , Tag > ,
@@ -86,7 +86,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
8686 return Ok ( -1 ) ;
8787 }
8888
89- let tv = this. force_ptr ( this . read_scalar ( tv_op) ? . not_undef ( ) ? ) ?;
89+ let tv = this. deref_operand ( tv_op) ?;
9090
9191 let duration = get_time ( ) ?;
9292 let tv_sec = duration. as_secs ( ) as i128 ;
@@ -97,7 +97,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
9797 int_to_immty_checked ( tv_usec, this. libc_ty_layout ( "suseconds_t" ) ?) ?,
9898 ] ;
9999
100- this. write_immediates ( & tv, & imms) ?;
100+ this. write_packed_immediates ( & tv, & imms) ?;
101101
102102 Ok ( 0 )
103103 }
0 commit comments