naseeam
asked on
How to convert Date to Unix format ?
What is Unix Date ?
Present date is stored in 16-bit modbus register as follows:
Bits 0 - 4 Day of Month
Bits 5 - 8 Month of Year
Bits 9 - 15 (Year - 2000) (0 to 128 == 2000 to 2128 )
How to conver this date to unix format ?
Thank you!
Present date is stored in 16-bit modbus register as follows:
Bits 0 - 4 Day of Month
Bits 5 - 8 Month of Year
Bits 9 - 15 (Year - 2000) (0 to 128 == 2000 to 2128 )
How to conver this date to unix format ?
Thank you!
ASKER
Thanks for great and concise response.
For tm_mon, I believe bitwise and with 0x0f instead of 0x07.
For tm_year, I believe bitwise and with 0x7f instead of 0x3f.
In our system, time_t is declared as follows:
typedef unsigned int time_t;
time_t is only two bytes. Is that sufficent to store unix time ?
For tm_mon, I believe bitwise and with 0x0f instead of 0x07.
For tm_year, I believe bitwise and with 0x7f instead of 0x3f.
In our system, time_t is declared as follows:
typedef unsigned int time_t;
time_t is only two bytes. Is that sufficent to store unix time ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window