DRAFT lib/m2: SYS_gettimeofday expects pointers.

* lib/m2/time.c (time): Pass address of parameters, use `.' instead of
`->' for member selection.
This commit is contained in:
Meghan Denny 2023-01-23 20:42:18 -08:00 committed by Jan (janneke) Nieuwenhuizen
parent f92727fba9
commit 3d1dcc3971
1 changed files with 4 additions and 3 deletions

View File

@ -1,6 +1,7 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2023 Meghan Denny <hello@nektro.net>
*
* This file is part of GNU Mes.
*
@ -28,10 +29,10 @@ time (long* result)
int r;
struct timeval tv;
struct timezone tz;
r = _sys_call2 (SYS_gettimeofday, tv, tz);
r = _sys_call2 (SYS_gettimeofday, &tv, &tz);
if (r != 0)
return -1;
if (result != 0)
result[0] = tv->tv_sec;
return tv->tv_sec;
result[0] = tv.tv_sec;
return tv.tv_sec;
}