Saturday, 18 July 2015

[Arduino] Timestamp function

Arduino don't have the function which convert hhmmss and ddmmyy to unix timestamp and because I was looking to combine my data to one universal time, I did't find a method to achieve that.

I came across to the library TIME which is a good library but because I had to optimise my code and have the sketch as small as possible ( developing for Arduino pro mini ), I extracted the necessary function  and variables to generate timestamp.
The file is available on my github here and this is how you can use the function:

From the date:01.06.2015 and time 20:10:00 you will have call the function like this:



and it will return a long number which is unix timestamp.

No comments:

Post a comment