How to read wall clock time on NUCLEO-L476RG
Hi,
I'm trying to set the RTC date and time when uploading my code to a NUCLEO-L476RG board. I've already configured the RTC in CubeMX, and it works as it should. But I've only managed to set the time manually by setting the BCD values for Hours, Minutes, Seconds and so on in CubeMX when configuring the RTC (or changing them directly in the RTC init function).
So I would like to know if there is a way to read the current wall clock time from the PC and use this to set the RTC. I've tried including time.h and using time(NULL) to read the wall clock time, but it returns -1 (which according to the docs means calendar time is not available). Do I need to configure the GCC toolchain to be able to use time.h, or is there another way to read wall clock time onto the NUCLEO board?
Any help is much appreciated.
