I was upgrading to esphome 2023.12.5 from an earlier version and it would no longer compile. It was throwing an error 'time() is ambiguous'. After some searching and help I found out using ::time() solves the problem. Here is a PR for that specific fix.
In file included from src/esphome/components/homeassistant/time/homeassistant_time.h:4,
from src/esphome.h:24,
from src/main.cpp:3:
src/esphome/components/time/real_time_clock.h:11:11: note: candidates are: 'namespace esphome::time { }'
namespace time {
^~~~
In file included from /data/cache/platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/newlib/platform_include/time.h:22,
from /data/cache/platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/sys-include/sys/time.h:414,
from /data/cache/platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/newlib/platform_include/sys/time.h:16,
from /data/cache/platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/newlib/platform_include/pthread.h:18,
from /data/cache/platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/xtensa-esp32-elf/no-rtti/bits/gthr-default.h:48,
from /data/cache/platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/xtensa-esp32-elf/no-rtti/bits/gthr.h:151,
from /data/cache/platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/ext/atomicity.h:35,
from /data/cache/platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/bits/basic_string.h:39,
from /data/cache/platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/string:52,
from /data/cache/platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/stdexcept:39,
from /data/cache/platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/array:39,
from src/esphome/components/api/api_noise_context.h:3,
from src/esphome/components/api/api_frame_helper.h:13,
from src/esphome/components/api/api_connection.h:3,
from src/esphome.h:3,
from src/main.cpp:3:
/data/cache/platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/sys-include/time.h:59:11: note: 'time_t time(time_t*)'
time_t time (time_t *_timer);
^~~~
I was upgrading to esphome 2023.12.5 from an earlier version and it would no longer compile. It was throwing an error 'time() is ambiguous'. After some searching and help I found out using
::time()
solves the problem. Here is a PR for that specific fix.