cscg22-gearboy

CSCG 2022 Challenge 'Gearboy'
git clone https://git.sinitax.com/sinitax/cscg22-gearboy
Log | Files | Refs | sfeed.txt

time.h (915B)


      1/** @file time.h
      2    Sort of ANSI compliant time functions.
      3*/
      4#ifndef TIME_INCLUDE
      5#define TIME_INCLUDE
      6
      7#include <types.h>
      8#include <stdint.h>
      9
     10#define CLOCKS_PER_SEC 60
     11
     12typedef uint16_t time_t;
     13
     14/** Returns an approximation of processor time used by the program in Clocks
     15
     16    The value returned is the CPU time (ticks) used so far as a @ref clock_t.
     17
     18    To get the number of seconds used, divide by @ref CLOCKS_PER_SEC.
     19
     20    This is based on @ref sys_time, which will wrap around every ~18 minutes.
     21    (unsigned 16 bits = 65535 / 60 / 60 = 18.2)
     22
     23    @see sys_time, time()
     24*/
     25clock_t clock() OLDCALL;
     26
     27/** Converts clock() time to Seconds
     28
     29    @param t If pointer __t__ is not NULL, it's value will be set to the same seconds calculation as returned by the function.
     30
     31    The calculation is clock() / CLOCKS_PER_SEC
     32
     33    Returns: time in seconds
     34    @see sys_time, clock()
     35*/
     36time_t time(time_t *t);
     37
     38#endif