Let me just compile a full answer:
One is very very slighty off for some reason I think one counts a second as not 1 second but 0.99999999 ... seconds. Im not sure about a fix but for short term calculations it should be accurate enough (e.g) 14.9999999999999 and 15
For long term calculations a possible fix is using different libraries
// C++ program to find Current Day, Date
// and Local Time
#include<iostream>
#include<ctime>
using namespace std;
int main()
{
// Declaring argument for time()
time_t tt;
// Declaring variable to store return value of
// localtime()
struct tm * ti;
// Applying time()
time (&tt);
// Using localtime()
ti = localtime(&tt);
cout << "Current Day, Date and Time is = "
<< asctime(ti);
return 0;
}
number 2:
// CPP program to print current date and time
// using time and ctime.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
// declaring argument of time()
time_t my_time = time(NULL);
// ctime() used to give the present time
printf("%s", ctime(&my_time));
return 0;
}
number 3:
// CPP program to print current date and time
// using chronos.
#include <chrono>
#include <ctime>
#include <iostream>
using namespace std;
int main()
{
// Here system_clock is wall clock time from
// the system-wide realtime clock
auto timenow =
chrono::system_clock::to_time_t(chrono::system_clock::now());
cout << ctime(&timenow) << endl;
}
Another possible reason is: Leap Seconds
UTC is based on lots of atomic clocks in places all around the world. These clocks are more accurate then the rotation and movement of the earth so they sometimes add leap seconds or other various things from time to time.And as 1970 is a pretty dang while ago, there must have been a couple additions.
reference: https://www.geeksforgeeks.org/print-system-time-c-3-different-ways/