Skip to main content
Open topic with navigation CAPL Functions » General » Function Overview » convertTimestampToNS

convertTimestampToNS

Valid for: CANoe DE • CANoe:lite DE • CANoe4SW DE • CANoe4SW:lite DE

Function Syntax

Int64 convertTimestampToNS ( dword days, dword hours, dword minutes, dword seconds );

Description

Converts a time stamp given in days, hours, minutes and seconds into a nanosecond time stamp.

Parameters

  • days: Number of days of the time stamp.
  • hours: Number of hours of the time stamp.
  • minutes: Number of minutes of the time stamp.
  • seconds: Number of seconds of the time stamp.

Return Values

Time stamp in nanoseconds.

Example

variables
{
  dword days    = 432;
  dword hours   = 125;
  dword minutes = 102;
  dword seconds = 146;
}

on start
{
  write ("1 second = %I64d ns", ConvertTimestampToNS ( 0, 0, 0, 1 ));
  write ("1 minute = %I64d ns", ConvertTimestampToNS ( 0, 0, 1, 0 ));
  write ("1 hour   = %I64d ns", ConvertTimestampToNS ( 0, 1, 0, 0 ));
  write ("1 day    = %I64d ns", ConvertTimestampToNS ( 1, 0, 0, 0 ));

  write ("Sum of %d days %d hours %d minutes %d seconds = %I64d ns", days, hours, minutes, seconds, ConvertTimestampToNS ( days, hours, minutes, seconds ));
}