GBDK 2020 Docs 4.4.0 API Documentation for GBDK 2020

Macros | Typedefs | Functions
time.h File Reference
`#include <types.h>`
`#include <stdint.h>`

Go to the source code of this file.

## Macros
#define | CLOCKS_PER_SEC 60

## Typedefs
typedef uint16_t | time_t

## Functions
clock_t | clock (void) OLDCALL
time_t | time (time_t *t)

## Detailed Description

Sort of ANSI compliant time functions.

## Macro Definition Documentation

## ◆ CLOCKS_PER_SEC

#define CLOCKS_PER_SEC 60

## Typedef Documentation

## ◆ time_t

typedef uint16_t time_t

## Function Documentation

## ◆ clock()

clock_t clock | ( | void |  | ) |

Returns an approximation of processor time used by the program in Clocks

The value returned is the CPU time (ticks) used so far as a clock_t.

To get the number of seconds used, divide by CLOCKS_PER_SEC.

This is based on sys_time, which will wrap around every ~18 minutes. (unsigned 16 bits = 65535 / 60 / 60 = 18.2)

See also
  sys_time, time()

## ◆ time()

time_t time | ( | time_t * | t | ) |

Converts clock() time to Seconds

Parameters

  t | If pointer t is not NULL, it's value will be set to the same seconds calculation as returned by the function.

The calculation is clock() / CLOCKS_PER_SEC

Returns: time in seconds

See also
  sys_time, clock()