首页 \ 问答 \ 为什么同一时间的Unix时间戳在不同的时区有所不同(why Unix Time Stamp for same time is different in different timezone)

为什么同一时间的Unix时间戳在不同的时区有所不同(why Unix Time Stamp for same time is different in different timezone)

为什么7/18/2013 11:33在GMT时区和我当地的时区(亚洲/ kolkata)中有所不同? 由于Unix时间戳是从纪元时间1/1/1970 00:00:00 GMT开始计算的刻度,所以我知道在不同时区的不同时间间隔内发生了纪元时间,但仍然存在。 第二次过去的次数应该是相同的

例如,如果我(+5:30 GMT)和我的朋友(+5:00 GMT)分别从00:00小时开始计算滴答时间,那么在18:00小时,两个时区的滴答数应该相同。 那么为什么同样的事情在Unix时间戳上不是这样。

需要充分理解这个概念。


Why 7/18/2013 11:33 is different in GMT timezone and in my local Time Zone (Asia/kolkata)? As Unix time-stamp are the ticks being calculated since epoch time 1/1/1970 00:00:00 GMT so i know that there the epoch time had occurred at different interval in different timezone but still. the number of second elapsed should have been same

For example if I(+5:30 GMT) and My friend(+5:00 GMT) starts counting the ticks from 00:00 Hrs respectively so at 18:00 Hrs in both timezone number of ticks should be same. So why same thing is not true with the Unix time-stamp.

Need to Understand the concept fully.


原文:https://stackoverflow.com/questions/17716367
更新时间:2022-03-22 15:03

最满意答案

尽管脚本将被并行下载,但它们的执行顺序并不确定。 IE将按照它们完成下载的顺序执行它们,而Firefox则按照它们在DOM中附加的顺序执行它们。

这是个问题。 例如,说脚本A和脚本B是使用该技术添加的。 现在想象一下脚本A是jQuery,脚本B是这样做的:

$(document).ready(function(){...})

在IE中,如果出于任何原因(例如,网络流量,缓存未命中),脚本B在脚本A之前完成下载,因为它将在jQuery加载之前执行。

请参阅本文以获得更好的解释。

至于解决方案,您可以<script>元素放置在页面尽可能远的地方 (例如,在关闭</body>元素之前)。尽管这不能保证并行下载,但它有助于缓解“阻塞”问题解决方案在寻址。


Although scripts will be downloaded in parallel, the order in which they are executed is not deterministic. IE will execute them in the order they finish downloading in, whereas Firefox executes them in the order they are attached in the DOM.

This is a problem. For example, say script A and script B are added using that technique. Now imagine script A is jQuery, and script B does this:

$(document).ready(function(){...})

In IE you're screwed if for whatever reason (eg, network traffic, cache miss) script B finishes downloading before script A, because it will be executed before jQuery has been loaded.

See this article for a better explanation.

As for a solution, you can instead place the <script> elements as far down the page as possible (eg before the closing </body> element. Although this does not guarantee parallel downloads, it does help alleviate the "blocking" problem your solution is addressing.

相关问答

更多
  • 协议方法是常规功能,而不是协同程序。 他们里面没有屈服点 。 因此执行顺序非常简单:所有调用都是序列化的,竞争条件是不可能的。 UPD 在示例中, pipe_data_received()不是协程,而只是一个没有yield from内部的await / yield from的函数。 asyncio总是立即执行整个操作,中间没有任何上下文切换。 您可能认为pipe_data_received()受锁保护,但实际上不需要任何锁定。 如果您有这样的协程,则锁定是必需的: async def incr(self): ...
  • 当两个或多个线程可以访问共享数据并且他们尝试同时更改时,发生竞争条件。 因为线程调度算法可以随时在线程之间交换,您不知道线程将尝试访问共享数据的顺序。 因此,数据变化的结果取决于线程调度算法,即两个线程都是“赛车”来访问/更改数据。 当一个线程执行“check-then-act”(例如,如果值为X,则“检查”),然后“执行”执行取决于值为X的某些事情,则另一个线程会执行某些值在“支票”和“行为”之间。 例如: if (x == 5) // The "Check" { y = x * 2; // The ...
  • 异步加载的几个解决方案: //this function will work cross-browser for loading scripts asynchronously function loadScript(src, callback) { var s, r, t; r = false; s = document.createElement('script'); s.type = 'text/javascript'; s.src = src; s.on ...
  • 如果您希望程序始终写入Dep Value: 10 ,那么是的,您的程序会受到竞争条件的影响,可能导致打印其他值。 为了演示这个问题,只需在内循环中引入一个延迟: int depdt = 0; Parallel.For(1, 10, mem => { for (int dep = 1; dep <= 10; dep++) { depdt = dep; Console.WriteLine("MEMBER: " + mem + " " + "Dependent: " ...
  • 尽管脚本将被并行下载,但它们的执行顺序并不确定。 IE将按照它们完成下载的顺序执行它们,而Firefox则按照它们在DOM中附加的顺序执行它们。 这是个问题。 例如,说脚本A和脚本B是使用该技术添加的。 现在想象一下脚本A是jQuery,脚本B是这样做的: $(document).ready(function(){...}) 在IE中,如果出于任何原因(例如,网络流量,缓存未命中),脚本B在脚本A之前完成下载,因为它将在jQuery加载之前执行。 请参阅本文以获得更好的解释。 至于解决方案,您可以将
  • 问题是由swapCursor()不关闭先前的MergeCursor游标引起的。 关闭前一个光标解决了问题,但引入了一个新问题,因为你不应该从onLoadFinished()关闭游标,并且当关闭MergeCursor , MergeCursor关闭所有子游标。 这是通过切换回使用changeCursor()来解决的,每当我使用适配器只显示MergeCursor (某些适配器在没有来自onLoadFinished()数据时显示MergeCursor和MatrixCursor并且由于某种原因, MatrixCur ...
  • 下载可能是也可能不并行(取决于浏览器),但脚本的解析按照它们放置在页面上的顺序进行。 如果您使用该顺序( a.js之前的b.js ),在b.js声明但在a.js调用的foo() ,这将导致错误,因为foo()在它存在之前被调用。 这就是为什么JS库鼓励您在任何用户脚本之前加载脚本的原因。 这样,在您使用它们之前就存在它们的引用。 Downloads may or may not be in parallel (depending on the browser), but parsing of the scr ...
  • 您可以使用脚本的load事件: function loadScript(callback) { var script = document.createElement("script"); script.type = "text/javascript"; script.src = "http://maps.googleapis.com/maps/api/js?key=-MY-KEY-&sensor=true&callback=initialize"; document.bod ...
  • 我用Google搜索“jQuery嵌套时”,并发现这个作为起点重新加入这个jsfiddle 。 我在上面实现的代码看起来很好,就像这个例子所示 - 第二个时候jquery调用/然后直到第一个set完成才被调用,这正是我认为我想要的依赖性。 这是javascript代码: function message(html) { $('
    ').html(html).appendTo($('body')); } function process(){ $.when(a1(), a2()) ...
  • 将脚本添加到正文末尾是最佳解决方案。 它仍然允许加载DOM而不阻塞脚本标记。 此外,如果您将脚本放在文档的末尾,则不再需要将函数包装在DOM ready事件中,因为在脚本开始执行时,浏览器已经加载了DOM,您可以直接开始操作它或者订阅一些活动。 Appending the scripts at the end of the body is the best solution here. It still allows for loading the DOM without blocking for the ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)