Using time Functions with Arduino

I am trying to port some code from mbed into Arduino, and I'm stuck on some time functions.

I don't have an RTC yet, so for now i need to code in the current unix time:

set_time(1590539298);

Then I can use that to convert to julian:

jdC = getJulianFromUnix(time(NULL));

Where time(NULL) is the current Unix time. Since it was set previously with set_time(), it will be current.

I can't seem to find an equivalent in Arduino for the set_time() and time() functions.

Any suggestions?

Thanks,
-M

"I can't seem to find an equivalent in Arduino for the set_time() and time() functions."

That's because they don't exist. The Arduino has a concept of how many milliseconds or microseconds have elapsed since booting so I suppose that you could write your own functions, but the Arduino is limited to 32 bits of milliseconds so you would have to deal with THAT limitation also.

However, the usual uses of Arduinos only require millis() or micros(), so Unix time is usually unnecessary.

Time is a library that provides timekeeping functionality for Arduino.
Using the Arduino Library Manager, install "Time by Michael Margolis".

Reference material here

You could start with the DateTime library. The native time functions depend on which compiler you're using, which depends on which board you're using. Here is the AVR version:
https://www.nongnu.org/avr-libc/user-manual/group__avr__time.html

I included Time.h and that seems to be giving me the functionality that I need with setTime() and now().

Thanks for the replies!