X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=platform%2Fexample%2Ffunctions%2Ftime%2Fclock.c;fp=functions%2Ftime%2Ftime.c;h=825e040e9e62ffaad8585972f9b4df508918f35a;hp=4ef5180cf6aba918e291cf00330c03148e4544f2;hb=686f7a4b4a7e154990831d13e0431190c60a335d;hpb=8481519337ff8acf46db6b91fb9484777fd89609 diff --git a/functions/time/time.c b/platform/example/functions/time/clock.c similarity index 64% rename from functions/time/time.c rename to platform/example/functions/time/clock.c index 4ef5180..825e040 100644 --- a/functions/time/time.c +++ b/platform/example/functions/time/clock.c @@ -1,4 +1,4 @@ -/* time( time_t * ) +/* clock( void ) This file is part of the Public Domain C Library (PDCLib). Permission is granted to use, modify, and / or redistribute at will. @@ -8,8 +8,15 @@ #ifndef REGTEST -time_t time( time_t * timer ) +#include + +clock_t clock( void ) { + struct tms buf; + if ( times( &buf ) != (clock_t)-1 ) + { + return buf.tms_utime + buf.tms_stime; + } return -1; }