rusEFI
The most advanced open source ECU
Functions
efitime.h File Reference

Detailed Description

By the way, there are 86400000 milliseconds in a day

Date
Apr 14, 2014
Author
Andrey Belomutskiy, (c) 2012-2020

Definition in file efitime.h.

Functions

int time2print (int64_t time)
 
uint32_t getTimeNowLowerNt ()
 
efitimems_t getTimeNowMs ()
 Returns the 32 bit number of milliseconds since the board initialization. More...
 
efitimesec_t getTimeNowS ()
 Current system time in seconds (32 bits) More...
 
void setTimeNowUs (int us)
 
void advanceTimeUs (int us)
 

Function Documentation

◆ advanceTimeUs()

void advanceTimeUs ( int  us)

◆ getTimeNowLowerNt()

uint32_t getTimeNowLowerNt ( )

Get a monotonically increasing (but wrapping) 32-bit timer value Implemented at port level, based on timer or CPU tick counter Main source of EFI clock, SW-extended to 64bits

2147483648 / ~168MHz = ~12 seconds to overflow

Definition at line 43 of file microsecond_timer_gpt.cpp.

43  {
44  return port_rt_get_counter_value();
45 }

Referenced by getTimeNowNt(), handleShaftSignal(), onLockHook(), onUnlockHook(), portMicrosecondTimerCallback(), and testBinary().

Here is the caller graph for this function:

◆ getTimeNowMs()

efitimems_t getTimeNowMs ( )

Returns the 32 bit number of milliseconds since the board initialization.

32 bit return type overflows in 23(or46?) days. tag#4554. I think we do not expect rusEFI to run for 23 days straight days any time soon?

Definition at line 34 of file efitime.cpp.

34  {
35  return US2MS(getTimeNowUs());
36 }
efitimeus_t getTimeNowUs()
Definition: efitime.cpp:26

Referenced by assertTimeIsLinear(), printGpsInfo(), sayHello(), StepperMotorBase::setInitialPosition(), slowStartStopButtonCallback(), testMath(), testRusefiMethods(), testSystemCalls(), updateTriggerWaveformIfNeeded(), and writeSdBlock().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getTimeNowS()

efitimesec_t getTimeNowS ( )

Current system time in seconds (32 bits)

32 bit integer number of seconds since ECU boot. 31,710 years - would not overflow during our life span.

Definition at line 42 of file efitime.cpp.

42  {
43  return getTimeNowUs() / US_PER_SECOND;
44 }

Referenced by TriggerDecoderBase::decodeTriggerEvent(), AcController::getAcState(), handleTestCommand(), Engine::periodicSlowCallback(), printRusefiVersion(), sendQcBenchBoardStatus(), THD_FUNCTION(), timeInfo(), updateDevConsoleState(), and updateTunerStudioState().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setTimeNowUs()

void setTimeNowUs ( int  us)

◆ time2print()

int time2print ( int64_t  time)
inline

Go to the source code of this file.