NDK  2.24.01.18
 All Files Functions Pages
Functions
mytime.h File Reference

Detailed Description

The MYTIME module uses the SYS/BIOS Clock module to keep track of system time for hardware platforms that do not have a Real Time Clock.

The module internally tracks the time by keeping count of the number of seconds since the Epoch, which is defined to be January 1, 1970.

Users of the MYTIME module can access its internal time value using supplied getter and setter functions.

Example Usage

The MYTIME module is part of the NDK nettools library. An application should include its header file as follows:

* #include <ti/ndk/nettools/mytime/mytime.h>
*

Initializing The MYTIME Module

To initialize and start the MYTIME module clock, call the following function:

*

Getting The Current Time

The internal time value can be obtained by calling the MYTIME_gettime() function:

* uint32_t currentTime = MYTIME_gettime();
*

Setting The Current Time

The internal time value can be set by calling the MYTIME_settime() function:

* uint32_t newTime = 100;
* MYTIME_settime(newTime);
*

Deinitializing The MYTIME Module

The following function can be called to stop the MYTIME Clock and free its resources:

*

#include <xdc/std.h>
#include <stdint.h>
Include dependency graph for mytime.h:

Go to the source code of this file.

Functions

void MYTIME_init (void)
 Create a new Clock instance that ticks every second. More...
 
void MYTIME_exit (void)
 Stops and deletes the Clock instance created in the init function. More...
 
uint32_t MYTIME_gettime (void)
 Returns the number of seconds since the Epoch (January 1, 1970). More...
 
void MYTIME_settime (uint32_t newtime)
 Sets the time to the value passed in via the newtime parameter (units in seconds). More...
 

Function Documentation

void MYTIME_init ( void  )

Create a new Clock instance that ticks every second.

void MYTIME_exit ( void  )

Stops and deletes the Clock instance created in the init function.

uint32_t MYTIME_gettime ( void  )

Returns the number of seconds since the Epoch (January 1, 1970).

Returns
The number of seconds since January 1, 1970
void MYTIME_settime ( uint32_t  newtime)

Sets the time to the value passed in via the newtime parameter (units in seconds).

Parameters
newtimeTime in seconds since the Epoch to set the time to
Copyright 2014, Texas Instruments Incorporated