Keil Logo


4.4 _clock_init()

Defined in rt_misc.h, the _clock_init() function is an initialization function for clock().

It is not part of the C library standard, but the ARM® C library supports it as an extension.


void _clock_init(void);


This is a function that you can re-implement in an implementation-specific way. It is called from the library initialization code, so you do not have to call it from your application code.


You must re-implement this function if you re-implement clock().
The initialization that _clock_init() applies enables clock() to return the time that has elapsed since the program was started.
An example of how you might re-implement _clock_init() might be to set the timer to zero. However, if your implementation of clock() relies on a system timer that cannot be reset, then _clock_init() could instead read the time at startup (when called from the library initialization code), with clock() subsequently subtracting the time that was read at initialization, from the current value of the timer. In both cases, some form of initialization is required of _clock_init().
Non-ConfidentialPDF file icon PDF versionARM DUI0378H
Copyright © 2007, 2008, 2011, 2012, 2014-2016 ARM. All rights reserved. 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.