|
Post by (X) on Jan 29, 2023 20:37:17 GMT 1
I was toying with the idea of generating a unique index for a database table and I didn't like the fact that GUID encodes the local PC's MAC address.
It seemed sufficient to get a value based on Universal time or Zulu or Greenwich or UTC or whatever you want to call it. As long as anyone in the world, independant of their time zone or local clocks, can confidently generate a unique index.
Here is a way I found to retrieve the coordinated universal time (UTC). There could very well be a more direct method. I search for an API and found out the rabbit hole goes quite far down. Suffice to say: "complicated" is not what I'm looking for.
With this demo I am accesing the text file return by the following URL and extracting the UTC and Unix Time from the downloaded text file.
And spit out the information we need.
See following post.
Attachments:
|
|
|
Post by (X) on Jan 30, 2023 1:09:09 GMT 1
This demo gets the UTC from a JSON file.
I cannot guarantee my method can parse all JSON data, but, for this case it seems to work. The advantage of doing it this way is that, now, all item values can easily be accessed by name via a Hash table.
If you didn't know Hash tables existed, and worked with computers long enough, you would no doubt invent them, thinking they are the greatest thing since sliced bread!
|
|
|
Post by (X) on Feb 1, 2023 15:32:16 GMT 1
This post shows how to get UTC and Unix Time from another site: www.utctime.net/
|
|