社交网站如何保持帖子的时间精确到系统时间 [英] how social networking sites maintain timing of post exact to the system time

查看:69
本文介绍了社交网站如何保持帖子的时间精确到系统时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道社交网站定时维护。它的服务器处于固定位置,那么它将如何获得不同位置或国家的确切时间。



For例如:



我在社交网站上发布了一些内容(上午9:30),然后它显示了帖子的确切时间(上午9:30)或显示准确的系统时间。



请解释查询以显示系统的确切时间。时间将独立于服务器位置。

I wanna know about social networking sites timing maintenance.It's server is at fixed position then how will it get the exact timing at different location or country.

For example:

I have posted something at (9:30 AM) on social networking sites then it shows the exact time(9:30 AM) of post or it shows exact your system time.

please explain the query to show exact timing of system everywhere.Timing will be independent from server location.

推荐答案

嗯......它不是独立于服务器时间的。然而......就是这样。



你所做的是将所有值存储在服务器中相对于特定时区(可以是时区)服务器通常存在,但这可能是一个坏主意) - 最好的选择区域是UCT:通用协调时间 [ ^ ]这不是时区所有! :笑:



UTC以单一地理经度线为参考,不受夏令时或冬令时的影响,是所有人的基础世界时区。如果您以UTC格式存储您的值,那么您可以动态地将它们转换为当地时间,以便在世界任何地方为正确的用户 - 当地时间将照顾正负x小时,夏令时等。因此,您的用户最终得到的是他们当前位置的特定时间,无论他们从哪里登录。
Well...it's isn't independant of the server time. And yet...it is, sort of.

What you do is store all values in the server relative to a specific time zone (which can be the time zone the server normally lives in but that can be a bad idea) - and the best zone to pick is UCT: Universal Coordinated Time[^] which isn't a time zone at all! :laugh:

UTC is referenced to a single geographic line of longitude and is never affected by "summer time" or "winter time", and is the base for all world time zones. If you store your values in UTC, then you can convert them on the fly to the local time for the correct user anywhere in the world - and the local time will take care of plus or minus x hours, summer time, and so forth. So what your user ends up with is the time specific to their current location, regardless of where in the world they log in from.


这篇关于社交网站如何保持帖子的时间精确到系统时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆