Your question seems (to me) a bit too broad.
In principle, time is usually provided by the underlying vendor SDK; in the case of the ESP32, for example, Espressif’s IDF. You can get from mOS an int64_t current time in microseconds, which will be enough for your applications’ needs.
As per the other libraries, if you have some in mind perhaps someone may comment. Some will in fact depend on the protocol they handle, for example SNTP, which means you will have to provide for updates to keep current. I wouldn’t expect a networked device to be fully operational 18 years from now without updates anyway. These protocol handlers themselves sometimes also depend on a provider (lwIP, for example), but this may be different among different devices.