I am currently developing an app and I need to check the time quite often. But it is really important that the users can't change it themself, which is the case with DateTime.now() in flutter. Everyone can just change their phone time and manipulate the app. So I found a website where you can get the time and use it in your app.
The Problem with this is, that the website is very buggy at this time. It gives me errors almost all the time and this wasn't the case a couple of months ago.
So I was wondering if there is a reliable source to get the time.
And if not my idea was to get the time with this php code:
<?php
$date = new DateTime('now', new DateTimeZone('Europe/Berlin'));
echo $date->format("Y-m-d H:i:s.v");
?>
I would upload it to my file manager at my website. But I was thinking when I do this, and I want my app to be for commercial use eventually, then I might have to upgrade my server, because I get the time quite often about 10 times per app use I would say. So I got an idea, what if I get the time once when the User starts the app and then use a timer that is counting in milliseconds and then just use the time I got when first starting the app + the count of the timer.
So my question in conclusion is: Would my idea work (in terms of performance and accuracies) or is there any better way to do so.