I think sticking with the bundled/built-in POSIX time API functions would be better as the API functions are well documented since they have't changed in like 40+ years and it is portable across all platforms including linux.
Just combine it with the ESP specific functions to set the TZ environment variable and NTP configuration to initialize things.
$ idfexp Detecting the Python interpreter Checking "python" ... Python 3.8.10 "python" has been detected Adding ESP-IDF tools to PATH... Using Python interpreter in /home/grandfatherpikhto/.espressif/python_env/idf4.4_py3.8_env/bin/python Checking if Python packages are up to date... Python requirements from /home/grandfatherpikhto/espressif/esp-idf/requirements.txt are satisfied. Added the following directories to PATH: /home/grandfatherpikhto/espressif/esp-idf/components/esptool_py/esptool /home/grandfatherpikhto/espressif/esp-idf/components/espcoredump /home/grandfatherpikhto/espressif/esp-idf/components/partition_table /home/grandfatherpikhto/espressif/esp-idf/components/app_update /home/grandfatherpikhto/.espressif/tools/xtensa-esp32-elf/esp-2021r1-8.4.0/xtensa-esp32-elf/bin /home/grandfatherpikhto/.espressif/tools/xtensa-esp32s2-elf/esp-2021r1-8.4.0/xtensa-esp32s2-elf/bin /home/grandfatherpikhto/.espressif/tools/xtensa-esp32s3-elf/esp-2021r1-8.4.0/xtensa-esp32s3-elf/bin /home/grandfatherpikhto/.espressif/tools/riscv32-esp-elf/esp-2021r1-8.4.0/riscv32-esp-elf/bin /home/grandfatherpikhto/.espressif/tools/esp32ulp-elf/2.28.51-esp-20191205/esp32ulp-elf-binutils/bin /home/grandfatherpikhto/.espressif/tools/esp32s2ulp-elf/2.28.51-esp-20191205/esp32s2ulp-elf-binutils/bin /home/grandfatherpikhto/.espressif/tools/openocd-esp32/v0.10.0-esp32-20210721/openocd-esp32/bin /home/grandfatherpikhto/.espressif/python_env/idf4.4_py3.8_env/bin /home/grandfatherpikhto/espressif/esp-idf/tools Done! You can now compile ESP-IDF projects. Go to the project directory and run:
Requirement already satisfied: cffi>=1.12 in c:\users\grand.espressif\python_env\idf4.4_py3.9_env\lib\site-packages (from cryptography>=2.1.4->-r C:\Users\grand\espressif\esp-idf\requirements.txt (line 11)) (1.14.6)
Requirement already satisfied: pycparser in c:\users\grand.espressif\python_env\idf4.4_py3.9_env\lib\site-packages (from cffi>=1.12->cryptography>=2.1.4->-r C:\Users\grand\espressif\esp-idf\requirements.txt (line 11)) (2.20)
Requirement already satisfied: MarkupSafe>=2.0 in c:\users\grand.espressif\python_env\idf4.4_py3.9_env\lib\site-packages (from Jinja2>=2.4->Flask=0.12.2->gdbgui==0.13.2.0->-r C:\Users\grand\espressif\esp-idf\requirements.txt (line 15)) (2.0.1)