Should I have trust in the system time? - datetime

Whenever I log something i ask myself: "What if this runs on an computer with incorrect time settings?"
The local time can be wrong but am I right that this might also be the case with UTC time?
My current approach is to get the NIST time and just write it on top of every log file together with the UTC and local time so the user looking at the log file can see how the time inside the log is related to the real world time.
Is this correct behaviour to print NIST + UTC + Local time on top of every logfile + a small info message on how time work?
This of course assumes that if their clock is incorrect it stays incorrect in the same way throuout the full log file

Related

What do the adjust reasons in the BLE current time characteristic mean?

I am implementing a CTS (current time service) synchronization method. Here is the documentation on the current time characteristic (one of the characteristics in the CTS).
What do 'Manual time update' and 'External reference time update' mean, and what do they change on the device I am writing the current time on?
I have searched SO, WWW, and the Bluetooth SIG group but not found any further explanation than the names of those fields.
The specification document for Current Time Service defines these values (download pdf here from bluetooth.com).
Specifically, section 3.1.2 Characteristic Behavior -- Notification:
The server device shall set the Adjust Reason field in the Current Time to reflect the
reason for the last adjustment of the local time on the server device.
...
3.1.2.1 Manual Time Update
If the time information on the server device was set / changed manually,
the “Manual Time Update” bit shall be set.
Note: If the time zone or DST offset were changed manually, this bit shall also be set.
3.1.2.2 External Reference Time Update
If the server device received time information from an
external time reference source,
the External Reference Time Update bit shall be set.
3.1.2.3 Change of Time Zone
If the time information on the server device was set / adjusted
because of change of time zone, the “Change of Time Zone” bit shall be set.
Note: Following 3.1.2.1, if the time zone was changed manually the “Manual Time
Update” bit will also be set.
3.1.2.4 Change of DST Offset
If the time information on the server device was set / adjusted
because of change of DST offset, the “Change of DST offset” bit shall be set.
Note: Following 3.1.2.1, if the DST offset was changed manually, the “Manual Time
Update” bit will also be set.

How to get the time not from the device but from the internet?

I have a problem that If a person clock is not set correctly the app will take this time rather than the correct one that's why I wanted to take the time now form the internet. any idea ?
Note: I have used DateTime.now() and it provide back the mobile time not the real time

How can I set the time as c# [3 minutes before]

System time 12:05:00 string datetime = "12:15:00";
12:12:00 3 minutes ago MessageBox.Show ("3 minutes left");. How can i do it please give me a suggestion.
How can I update the Windows system clock time.windows.com I want to update the Windows time, but I know I can manually set the date time, but I do not know how to do it from the form
if you have a suggestion please share with me
As far as I can tell, you can't directly access the CMOS RTC clock under Windows via C#/.NET. In any case, from what I've read, doing so is likely to introduce other problems.
Instead, you might consider programmatically triggering Windows Internet Time to sync immediately, instead of having it wait up to a week for Windows to do it.
Another link for doing this
...and another one
...and yet another one (may be less helpful)
finally, here's a Code Project that seems to do something similar to what you want

Will rsync "catch-up" a file server that's been down for repair?

Let's say I have two NAS boxes (let's call them NAS1 and NAS2) that are rsync'ed. NAS1 is the primary target for all users, but it goes down for an extended period like a couple days or a week in need of repair, such as a power supply failure. We switch to using NAS2 as our target during this period with the intention of switching back to NAS1 when it's operational again.
Once NAS1 is back online, will rsync automatically take care of getting it caught back up to NAS2?

Current time in blackberry

Hi I need to know how can I get current time in blackberry if I change the device time
I am using system.getcurrenttimemillis() method
Is it possible ???
Or concept of network time comes into this
System.currentTimeMillis gives you a timestamp in UTC, which is roughly the time in the Greenwich Meridian.
If your time is updated via network or changed in settings then the returned value changes as well.

Resources