Number Of Seconds between 2 timestamps

 

I am trying to get my head around the arithmatic involved with MQLDateTime Structs. If someone can point me to a sample code (function) where I can pass 2 TimeStructs and it returns the integer / long integer / double value of the number of seconds between the 2 timestamps.

Highly appreciated.

Regards

 
Sat:

I am trying to get my head around the arithmatic involved with MQLDateTime Structs. If someone can point me to a sample code (function) where I can pass 2 TimeStructs and it returns the integer / long integer / double value of the number of seconds between the 2 timestamps.

Highly appreciated.

Regards

https://www.mql5.com/en/docs/basis/types/integer/datetime

Datetime Type

The datetime type is intended for storing the date and time as the number of seconds elapsed since January 01, 1970. This type occupies 8 bytes of memory.

Just use 2 datetime values ​​(subtract one from the other).

You don't need MqlDateTime to calculate the difference in seconds between 2 timestamps.
 
Vladislav Boyko #:

Just use 2 datetime values ​​(subtract one from the other).

You don't need MqlDateTime to calculate the difference in seconds between 2 timestamps.

Many thanks. I was overthinking.

int timelapsed=TimeCurrent()-OrderOpenTime();

works like a charm.