Is there a current implementation to get the localtime from the internet and not from the machine since on the machine the time can be tampered by the user? When I run the below code it shows me:
#include <iostream>
#include <iomanip>
#include <ctime>
int main()
{
std::time_t t = std::time(nullptr);
std::cout << "UTC: " << std::put_time(std::gmtime(&t), "%c %Z") << '\n';
std::cout << "local: " << std::put_time(std::localtime(&t), "%c %Z") << '\n';
}
Output:
UTC: Mon Sep 16 09:56:10 2019 GMT
local: Mon Sep 16 11:56:10 2019 CEST
But when I change the time on my Ubuntu 18.04 machine the time output of both functions changes, too. The usecase would be to use it for licensing since repos like licensepp use just plain gmtime which has the easy workaround of just changing the time of the machine to surpass the expiration date.
Is there a function which uses the internet to get a similar output like above without using the machine time? Any links, code snippets are appreciated. Thanks.