Sorting time in order

So I am planning on making an instagram style app. I have users being able to create an account, upload photos and create their own feed working. But the issue with my app is that, once you sign up, you can’t see your friends posts before you joined, only the ones they will post in the future. Then they will display in order.

So my question is, how to add a time stamp for when someone calls an upload, and how to compare it. Is there an API that has a GMT time to keep everything the same, then call upload.

I was thinking of some sort of API that has a tick counter or something, so every second, it ticks and adds like 0.00001 to the tick number and over time it will have a new one, then I can just display in ascending order? So the newest will show first. Is this such a thing or am I doing it all wrong :stuck_out_tongue:

All comments are much appreciated.

(edit)

This is only to show posts people have already posted. It is easy to append a post to a list, but I would like to be able to add a time stamp.

1 Like

I may be misunderstanding what you are trying to do, but could you not just use the “seconds since 1970” block to generate your timestamp?

4 Likes

Kyle is correct. The “seconds since 1970” returns the number of seconds since January 1st 1970 midnight GMT, so it is valid and uniform for any devices no matter what the local time is, no matter where the device is.

That makes it a perfectly robust, reliable time stamp.

3 Likes

I never seen this Kyle, thank you very much.

3 Likes