From: Lawrence S. <ljs...@us...> - 2022-08-18 00:54:08
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 1d1d49eddcf4f3041bda9b44c7464641ede77a6f (commit) from 81ec331be28e755ce34dc02bf6a1b0d1bf0559b0 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 1d1d49eddcf4f3041bda9b44c7464641ede77a6f Author: Lawrence Sebald <ljs...@us...> Date: Wed Aug 17 20:53:44 2022 -0400 Add simple implementation of _times_r. ----------------------------------------------------------------------- Summary of changes: kernel/libc/newlib/newlib_times.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/kernel/libc/newlib/newlib_times.c b/kernel/libc/newlib/newlib_times.c index 6038a84..1f957b9 100644 --- a/kernel/libc/newlib/newlib_times.c +++ b/kernel/libc/newlib/newlib_times.c @@ -1,15 +1,30 @@ /* KallistiOS ##version## newlib_times.c - Copyright (C)2004 Dan Potter + Copyright (C) 2004 Dan Potter + Copyright (C) 2022 Lawrence Sebald */ +#include <errno.h> #include <sys/reent.h> #include <sys/times.h> +#include <arch/timer.h> int _times_r(struct _reent * re, struct tms * tmsbuf) { (void)re; - (void)tmsbuf; + + if(tmsbuf) { + /* Conveniently, CLOCKS_PER_SEC is 1000, so we can just use the + millisecond timer. */ + tmsbuf->tms_utime = (clock_t)timer_ms_gettime64(); + tmsbuf->tms_stime = 0; + tmsbuf->tms_cutime = 0; + tmsbuf->tms_cstime = 0; + + return (int)tmsbuf->tms_utime; + } + + re->_errno = EFAULT; return -1; } hooks/post-receive -- A pseudo Operating System for the Dreamcast. |