如何在Excel VBA中提高调用API的速度。

huangapple go评论61阅读模式
英文:

how to improve speed in calling an API from Excel VBA

问题

如果我在Excel VBA中每秒调用WorksheetFunction.WebService,接收到的响应只在每4秒更新一次。

最初我注意到这个问题是在我的本地PC上的Excel和本地服务器之间存在的。尽管外部服务器也出现了相同的问题。可以通过调用下面的代码来测试这个问题,该代码每秒调用一个世界时间的API服务器:

Sub speedtest()

    For f = 1 To 10
    
        my_http = "http://worldtimeapi.org/api/timezone/Europe/Amsterdam"
        my_output = WorksheetFunction.WebService(my_http)
        Debug.Print my_output

        Application.Wait (Now + TimeValue("00:00:01"))
            
    Next f

End Sub

如果在Chrome中提交并刷新URL,它可以每秒正确更新。

在Excel VBA中是否有一种方法可以每秒接收API响应?

我注意到如果将URL提交给Power Query,它可以每秒刷新一次,尽管我需要在VBA中获取结果,而不是在需要工作表的地方使用Power Query。

非常感谢!

英文:

If I call WorksheetFunction.WebService in Excel VBA once a second, the received response is only updated once every 4 seconds.

Initially I noticed this issue between Excel and a local server on my local pc.
Although an external server gives the same issue. This can be tested with calling the code below which calls an api server for the worldtime once a second:

Sub speedtest()
    
    For f = 1 To 10
    
        my_http = "http://worldtimeapi.org/api/timezone/Europe/Amsterdam"
        my_output = WorksheetFunction.WebService(my_http)
        Debug.Print my_output

        Application.Wait (Now + TimeValue("00:00:01"))
            
    Next f

End Sub

>
"datetime":"2023-03-07T18:26:10.288974+01:00"
"datetime":"2023-03-07T18:26:10.288974+01:00"
"datetime":"2023-03-07T18:26:10.288974+01:00"
"datetime":"2023-03-07T18:26:10.288974+01:00"
"datetime":"2023-03-07T18:26:14.205044+01:00"
"datetime":"2023-03-07T18:26:14.205044+01:00"
"datetime":"2023-03-07T18:26:14.205044+01:00"
"datetime":"2023-03-07T18:26:14.205044+01:00"
"datetime":"2023-03-07T18:26:18.227253+01:00"
"datetime":"2023-03-07T18:26:18.227253+01:00"

If the url is submitted and refreshed in Chrome, it is updating once a second correctly.

Is there a method in Excel VBA to receive an API-response every second?

I noticed that if I submit the url to Power Query it can be refreshed once a second, although I need the result in VBA and not in a worksheet where Power Query seems to need a worksheet.

Thanks a lot!

答案1

得分: 0

我想你有一个缓存问题。
我编写了一个小测试例程,调用了该服务并暂停了1秒。

Dim i As Long
For i = 1 To 10
    Application.WebService ""
    Debug.Print i, Second(Now), city, Application.WebService("http://worldtimeapi.org/api/timezone/Europe/Amsterdam")
    Sleep 1000
Next

结果看起来像这样:

1 :3       {"abbreviation":"CET","client_ip":"2003:f8:af01:9e01:b035:2d9a:577:30e2","datetime":"2023-03-07T18:49:04.072029+01:00","day_of_week":2,"day_of_year":66,"dst":false,"dst_from":null,"dst_offset":0,"dst_until":null,"raw_offset":3600,"timezone":"Europe/Amsterdam","unixtime":1678211344,"utc_datetime":"2023-03-07T17:49:04.072029+00:00","utc_offset":"+01:00","week_number":10}
2 :5       {"abbreviation":"CET","client_ip":"2003:f8:af01:9e01:b035:2d9a:577:30e2","datetime":"2023-03-07T18:49:04.072029+01:00","day_of_week":2,"day_of_year":66,"dst":false,"dst_from":null,"dst_offset":0,"dst_until":null,"raw_offset":3600,"timezone":"Europe/Amsterdam","unixtime":1678211344,"utc_datetime":"2023-03-07T17:49:04.072029+00:00","utc_offset":"+01:00","week_number":10}
3 :6       {"abbreviation":"CET","client_ip":"2003:f8:af01:9e01:b035:2d9a:577:30e2","datetime":"2023-03-07T18:49:04.072029+01:00","day_of_week":2,"day_of_year":66,"dst":false,"dst_from":null,"dst_offset":0,"dst_until":null,"raw_offset":3600,"timezone":"Europe/Amsterdam","unixtime":1678211344,"utc_datetime":"2023-03-07T17:49:04.072029+00:00","utc_offset":"+01:00","week_number":10}
4 :7       {"abbreviation":"CET","client_ip":"2003:f8:af01:9e01:b035:2d9a:577:30e2","datetime":"2023-03-07T18:49:07.381876+01:00","day_of_week":2,"day_of_year":66,"dst":false,"dst_from":null,"dst_offset":0,"dst_until":null,"raw_offset":3600,"timezone":"Europe/Amsterdam","unixtime":1678211347,"utc_datetime":"2023-03-07T17:49:07.381876+00:00","utc_offset":"+01:00","week_number":10}
5 :8       {"abbreviation":"CET","client_ip":"2003:f8:af01:9e01:b035:2d9a:577:30e2","datetime":"2023-03-07T18:49:07.381876+01:00","day_of_week":2,"day_of_year":66,"dst":false,"dst_from":null,"dst_offset":0,"dst_until":null,"raw_offset":3600,"timezone":"Europe/Amsterdam","unixtime":1678211347,"utc_datetime":"2023-03-07T17:49:07.381876+00:00","utc_offset":"+01:00","week_number":10}
6 :9       {"abbreviation":"CET","client_ip":"2003:f8:af01:9e01:b035:2d9a:577:30e2","datetime":"2023-03-07T18:49:07.381876+01:00","day_of_week":2,"day_of_year":66,"dst":false,"dst_from":null,"dst_offset":0,"dst_until":null,"raw_offset":3600,"timezone":"Europe/Amsterdam","unixtime":1678211347,"utc_datetime":"2023-03-07T17:49:07.381876+00:00","utc_offset":"+01:00","week_number":10}
7 :10      {"abbreviation":"CET","client_ip":"2003:f8:af01:9e01:b035:2d9a:577:30e2","datetime":"2023-03-07T18:49:10.757293+01:00","day_of_week":2,"day_of_year":66,"dst":false,"dst_from":null,"dst_offset":0,"dst_until":null,"raw_offset":3600,"timezone":"Europe/Amsterdam","unixtime":1678211350,"utc_datetime":"2023-03-07T17:49:10.757293+00:00","utc_offset":"+01:00","week_number":10}
8 :12      {"abbreviation":"CET","client_ip":"2003:f8:af01:9e01:b035:2d9a:577:30e2","datetime":"2023-03-07T18:49:10.757293+01:00","day_of_week":2,"day_of_year":66,"dst":false,"dst_from":null,"dst_offset":0,"dst_until":null,"raw_offset":3600,"timezone":"Europe/Amsterdam","unixtime":1678211350,"utc_datetime":"2023-03-07T17:49:10.757293+00:00","utc_offset":"+01:00","week_number":10}
9 :13      {"abbreviation":"CET","client_ip":"2003:f8:af01:9e01:b035:2d9a:577:30e2","datetime":"2023-03-07T18:49:10.757293+01:00","day_of_week":2,"day_of_year":66,"dst":false,"dst_from":null,"dst_offset":0,"dst_until":null,"raw_offset":3600,"timezone":"Europe/Amsterdam","unixtime":1678211350,"utc_datetime":"2023-03-07T17:49:10.757293+00:00","utc_offset":"+01:00","week_number":10}
10 :14     {"abbreviation":"CET","client_ip":"2003:f8:af01:9e01:b035:2d9a:577:30e2","datetime":"2023-03-07T18:49:14.623928+01:00","day_of_week":2,"day_of_year":66,"dst":false,"dst_from":null,"dst_offset":0,"dst_until":null,"raw_offset":3600,"timezone":"Europe/Amsterdam","unixtime
<details>
<summary>英文:</summary>
I guess you have a caching problem.  
I wrote a small test routine that calls the service and pauses for 1s.
Dim i As Long
For i = 1 To 10
Application.WebService &quot;&quot;
Debug.Print i, Second(Now), city, Application.WebService(&quot;http://worldtimeapi.org/api/timezone/Europe/Amsterdam&quot;)
Sleep 1000
Next
The result looks like
1 :3       {&quot;abbreviation&quot;:&quot;CET&quot;,&quot;client_ip&quot;:&quot;2003:f8:af01:9e01:b035:2d9a:577:30e2&quot;,&quot;datetime&quot;:&quot;2023-03-07T18:49:04.072029+01:00&quot;,&quot;day_of_week&quot;:2,&quot;day_of_year&quot;:66,&quot;dst&quot;:false,&quot;dst_from&quot;:null,&quot;dst_offset&quot;:0,&quot;dst_until&quot;:null,&quot;raw_offset&quot;:3600,&quot;timezone&quot;:&quot;Europe/Amsterdam&quot;,&quot;unixtime&quot;:1678211344,&quot;utc_datetime&quot;:&quot;2023-03-07T17:49:04.072029+00:00&quot;,&quot;utc_offset&quot;:&quot;+01:00&quot;,&quot;week_number&quot;:10}
2 :5       {&quot;abbreviation&quot;:&quot;CET&quot;,&quot;client_ip&quot;:&quot;2003:f8:af01:9e01:b035:2d9a:577:30e2&quot;,&quot;datetime&quot;:&quot;2023-03-07T18:49:04.072029+01:00&quot;,&quot;day_of_week&quot;:2,&quot;day_of_year&quot;:66,&quot;dst&quot;:false,&quot;dst_from&quot;:null,&quot;dst_offset&quot;:0,&quot;dst_until&quot;:null,&quot;raw_offset&quot;:3600,&quot;timezone&quot;:&quot;Europe/Amsterdam&quot;,&quot;unixtime&quot;:1678211344,&quot;utc_datetime&quot;:&quot;2023-03-07T17:49:04.072029+00:00&quot;,&quot;utc_offset&quot;:&quot;+01:00&quot;,&quot;week_number&quot;:10}
3 :6       {&quot;abbreviation&quot;:&quot;CET&quot;,&quot;client_ip&quot;:&quot;2003:f8:af01:9e01:b035:2d9a:577:30e2&quot;,&quot;datetime&quot;:&quot;2023-03-07T18:49:04.072029+01:00&quot;,&quot;day_of_week&quot;:2,&quot;day_of_year&quot;:66,&quot;dst&quot;:false,&quot;dst_from&quot;:null,&quot;dst_offset&quot;:0,&quot;dst_until&quot;:null,&quot;raw_offset&quot;:3600,&quot;timezone&quot;:&quot;Europe/Amsterdam&quot;,&quot;unixtime&quot;:1678211344,&quot;utc_datetime&quot;:&quot;2023-03-07T17:49:04.072029+00:00&quot;,&quot;utc_offset&quot;:&quot;+01:00&quot;,&quot;week_number&quot;:10}
4 :7       {&quot;abbreviation&quot;:&quot;CET&quot;,&quot;client_ip&quot;:&quot;2003:f8:af01:9e01:b035:2d9a:577:30e2&quot;,&quot;datetime&quot;:&quot;2023-03-07T18:49:07.381876+01:00&quot;,&quot;day_of_week&quot;:2,&quot;day_of_year&quot;:66,&quot;dst&quot;:false,&quot;dst_from&quot;:null,&quot;dst_offset&quot;:0,&quot;dst_until&quot;:null,&quot;raw_offset&quot;:3600,&quot;timezone&quot;:&quot;Europe/Amsterdam&quot;,&quot;unixtime&quot;:1678211347,&quot;utc_datetime&quot;:&quot;2023-03-07T17:49:07.381876+00:00&quot;,&quot;utc_offset&quot;:&quot;+01:00&quot;,&quot;week_number&quot;:10}
5 :8       {&quot;abbreviation&quot;:&quot;CET&quot;,&quot;client_ip&quot;:&quot;2003:f8:af01:9e01:b035:2d9a:577:30e2&quot;,&quot;datetime&quot;:&quot;2023-03-07T18:49:07.381876+01:00&quot;,&quot;day_of_week&quot;:2,&quot;day_of_year&quot;:66,&quot;dst&quot;:false,&quot;dst_from&quot;:null,&quot;dst_offset&quot;:0,&quot;dst_until&quot;:null,&quot;raw_offset&quot;:3600,&quot;timezone&quot;:&quot;Europe/Amsterdam&quot;,&quot;unixtime&quot;:1678211347,&quot;utc_datetime&quot;:&quot;2023-03-07T17:49:07.381876+00:00&quot;,&quot;utc_offset&quot;:&quot;+01:00&quot;,&quot;week_number&quot;:10}
6 :9       {&quot;abbreviation&quot;:&quot;CET&quot;,&quot;client_ip&quot;:&quot;2003:f8:af01:9e01:b035:2d9a:577:30e2&quot;,&quot;datetime&quot;:&quot;2023-03-07T18:49:07.381876+01:00&quot;,&quot;day_of_week&quot;:2,&quot;day_of_year&quot;:66,&quot;dst&quot;:false,&quot;dst_from&quot;:null,&quot;dst_offset&quot;:0,&quot;dst_until&quot;:null,&quot;raw_offset&quot;:3600,&quot;timezone&quot;:&quot;Europe/Amsterdam&quot;,&quot;unixtime&quot;:1678211347,&quot;utc_datetime&quot;:&quot;2023-03-07T17:49:07.381876+00:00&quot;,&quot;utc_offset&quot;:&quot;+01:00&quot;,&quot;week_number&quot;:10}
7 :10      {&quot;abbreviation&quot;:&quot;CET&quot;,&quot;client_ip&quot;:&quot;2003:f8:af01:9e01:b035:2d9a:577:30e2&quot;,&quot;datetime&quot;:&quot;2023-03-07T18:49:10.757293+01:00&quot;,&quot;day_of_week&quot;:2,&quot;day_of_year&quot;:66,&quot;dst&quot;:false,&quot;dst_from&quot;:null,&quot;dst_offset&quot;:0,&quot;dst_until&quot;:null,&quot;raw_offset&quot;:3600,&quot;timezone&quot;:&quot;Europe/Amsterdam&quot;,&quot;unixtime&quot;:1678211350,&quot;utc_datetime&quot;:&quot;2023-03-07T17:49:10.757293+00:00&quot;,&quot;utc_offset&quot;:&quot;+01:00&quot;,&quot;week_number&quot;:10}
8 :12      {&quot;abbreviation&quot;:&quot;CET&quot;,&quot;client_ip&quot;:&quot;2003:f8:af01:9e01:b035:2d9a:577:30e2&quot;,&quot;datetime&quot;:&quot;2023-03-07T18:49:10.757293+01:00&quot;,&quot;day_of_week&quot;:2,&quot;day_of_year&quot;:66,&quot;dst&quot;:false,&quot;dst_from&quot;:null,&quot;dst_offset&quot;:0,&quot;dst_until&quot;:null,&quot;raw_offset&quot;:3600,&quot;timezone&quot;:&quot;Europe/Amsterdam&quot;,&quot;unixtime&quot;:1678211350,&quot;utc_datetime&quot;:&quot;2023-03-07T17:49:10.757293+00:00&quot;,&quot;utc_offset&quot;:&quot;+01:00&quot;,&quot;week_number&quot;:10}
9 :13      {&quot;abbreviation&quot;:&quot;CET&quot;,&quot;client_ip&quot;:&quot;2003:f8:af01:9e01:b035:2d9a:577:30e2&quot;,&quot;datetime&quot;:&quot;2023-03-07T18:49:10.757293+01:00&quot;,&quot;day_of_week&quot;:2,&quot;day_of_year&quot;:66,&quot;dst&quot;:false,&quot;dst_from&quot;:null,&quot;dst_offset&quot;:0,&quot;dst_until&quot;:null,&quot;raw_offset&quot;:3600,&quot;timezone&quot;:&quot;Europe/Amsterdam&quot;,&quot;unixtime&quot;:1678211350,&quot;utc_datetime&quot;:&quot;2023-03-07T17:49:10.757293+00:00&quot;,&quot;utc_offset&quot;:&quot;+01:00&quot;,&quot;week_number&quot;:10}
10 :14     {&quot;abbreviation&quot;:&quot;CET&quot;,&quot;client_ip&quot;:&quot;2003:f8:af01:9e01:b035:2d9a:577:30e2&quot;,&quot;datetime&quot;:&quot;2023-03-07T18:49:14.623928+01:00&quot;,&quot;day_of_week&quot;:2,&quot;day_of_year&quot;:66,&quot;dst&quot;:false,&quot;dst_from&quot;:null,&quot;dst_offset&quot;:0,&quot;dst_until&quot;:null,&quot;raw_offset&quot;:3600,&quot;timezone&quot;:&quot;Europe/Amsterdam&quot;,&quot;unixtime&quot;:1678211354,&quot;utc_datetime&quot;:&quot;2023-03-07T17:49:14.623928+00:00&quot;,&quot;utc_offset&quot;:&quot;+01:00&quot;,&quot;week_number&quot;:10}
So I changed the code by introducing a logic that changes the city, resulting in different URLs
Dim cities
cities = Array(&quot;Paris&quot;, &quot;Amsterdam&quot;, &quot;Berlin&quot;)
Dim i As Long
For i = 1 To 10
Application.WebService &quot;&quot;
Dim city As String
city = cities(i Mod (UBound(cities) + 1))
Debug.Print i &amp; &quot; :&quot; &amp; Second(Now), city, Application.WebService(&quot;http://worldtimeapi.org/api/timezone/Europe/&quot; &amp; city)
Sleep 1000
Next
This gave me
1 :24         Amsterdam     {&quot;abbreviation&quot;:&quot;CET&quot;,&quot;client_ip&quot;:&quot;2003:f8:af01:9e01:b035:2d9a:577:30e2&quot;,&quot;datetime&quot;:&quot;2023-03-07T18:56:25.298976+01:00&quot;,&quot;day_of_week&quot;:2,&quot;day_of_year&quot;:66,&quot;dst&quot;:false,&quot;dst_from&quot;:null,&quot;dst_offset&quot;:0,&quot;dst_until&quot;:null,&quot;raw_offset&quot;:3600,&quot;timezone&quot;:&quot;Europe/Amsterdam&quot;,&quot;unixtime&quot;:1678211785,&quot;utc_datetime&quot;:&quot;2023-03-07T17:56:25.298976+00:00&quot;,&quot;utc_offset&quot;:&quot;+01:00&quot;,&quot;week_number&quot;:10}
2 :26         Berlin        {&quot;abbreviation&quot;:&quot;CET&quot;,&quot;client_ip&quot;:&quot;2003:f8:af01:9e01:b035:2d9a:577:30e2&quot;,&quot;datetime&quot;:&quot;2023-03-07T18:56:27.031239+01:00&quot;,&quot;day_of_week&quot;:2,&quot;day_of_year&quot;:66,&quot;dst&quot;:false,&quot;dst_from&quot;:null,&quot;dst_offset&quot;:0,&quot;dst_until&quot;:null,&quot;raw_offset&quot;:3600,&quot;timezone&quot;:&quot;Europe/Berlin&quot;,&quot;unixtime&quot;:1678211787,&quot;utc_datetime&quot;:&quot;2023-03-07T17:56:27.031239+00:00&quot;,&quot;utc_offset&quot;:&quot;+01:00&quot;,&quot;week_number&quot;:10}
3 :28         Paris         {&quot;abbreviation&quot;:&quot;CET&quot;,&quot;client_ip&quot;:&quot;2003:f8:af01:9e01:b035:2d9a:577:30e2&quot;,&quot;datetime&quot;:&quot;2023-03-07T18:56:28.200192+01:00&quot;,&quot;day_of_week&quot;:2,&quot;day_of_year&quot;:66,&quot;dst&quot;:false,&quot;dst_from&quot;:null,&quot;dst_offset&quot;:0,&quot;dst_until&quot;:null,&quot;raw_offset&quot;:3600,&quot;timezone&quot;:&quot;Europe/Paris&quot;,&quot;unixtime&quot;:1678211788,&quot;utc_datetime&quot;:&quot;2023-03-07T17:56:28.200192+00:00&quot;,&quot;utc_offset&quot;:&quot;+01:00&quot;,&quot;week_number&quot;:10}
4 :29         Amsterdam     {&quot;abbreviation&quot;:&quot;CET&quot;,&quot;client_ip&quot;:&quot;2003:f8:af01:9e01:b035:2d9a:577:30e2&quot;,&quot;datetime&quot;:&quot;2023-03-07T18:56:30.576139+01:00&quot;,&quot;day_of_week&quot;:2,&quot;day_of_year&quot;:66,&quot;dst&quot;:false,&quot;dst_from&quot;:null,&quot;dst_offset&quot;:0,&quot;dst_until&quot;:null,&quot;raw_offset&quot;:3600,&quot;timezone&quot;:&quot;Europe/Amsterdam&quot;,&quot;unixtime&quot;:1678211790,&quot;utc_datetime&quot;:&quot;2023-03-07T17:56:30.576139+00:00&quot;,&quot;utc_offset&quot;:&quot;+01:00&quot;,&quot;week_number&quot;:10}
5 :31         Berlin        {&quot;abbreviation&quot;:&quot;CET&quot;,&quot;client_ip&quot;:&quot;2003:f8:af01:9e01:b035:2d9a:577:30e2&quot;,&quot;datetime&quot;:&quot;2023-03-07T18:56:31.760924+01:00&quot;,&quot;day_of_week&quot;:2,&quot;day_of_year&quot;:66,&quot;dst&quot;:false,&quot;dst_from&quot;:null,&quot;dst_offset&quot;:0,&quot;dst_until&quot;:null,&quot;raw_offset&quot;:3600,&quot;timezone&quot;:&quot;Europe/Berlin&quot;,&quot;unixtime&quot;:1678211791,&quot;utc_datetime&quot;:&quot;2023-03-07T17:56:31.760924+00:00&quot;,&quot;utc_offset&quot;:&quot;+01:00&quot;,&quot;week_number&quot;:10}
6 :32         Paris         {&quot;abbreviation&quot;:&quot;CET&quot;,&quot;client_ip&quot;:&quot;2003:f8:af01:9e01:b035:2d9a:577:30e2&quot;,&quot;datetime&quot;:&quot;2023-03-07T18:56:33.032718+01:00&quot;,&quot;day_of_week&quot;:2,&quot;day_of_year&quot;:66,&quot;dst&quot;:false,&quot;dst_from&quot;:null,&quot;dst_offset&quot;:0,&quot;dst_until&quot;:null,&quot;raw_offset&quot;:3600,&quot;timezone&quot;:&quot;Europe/Paris&quot;,&quot;unixtime&quot;:1678211793,&quot;utc_datetime&quot;:&quot;2023-03-07T17:56:33.032718+00:00&quot;,&quot;utc_offset&quot;:&quot;+01:00&quot;,&quot;week_number&quot;:10}
7 :34         Amsterdam     {&quot;abbreviation&quot;:&quot;CET&quot;,&quot;client_ip&quot;:&quot;2003:f8:af01:9e01:b035:2d9a:577:30e2&quot;,&quot;datetime&quot;:&quot;2023-03-07T18:56:35.399453+01:00&quot;,&quot;day_of_week&quot;:2,&quot;day_of_year&quot;:66,&quot;dst&quot;:false,&quot;dst_from&quot;:null,&quot;dst_offset&quot;:0,&quot;dst_until&quot;:null,&quot;raw_offset&quot;:3600,&quot;timezone&quot;:&quot;Europe/Amsterdam&quot;,&quot;unixtime&quot;:1678211795,&quot;utc_datetime&quot;:&quot;2023-03-07T17:56:35.399453+00:00&quot;,&quot;utc_offset&quot;:&quot;+01:00&quot;,&quot;week_number&quot;:10}
8 :36         Berlin        {&quot;abbreviation&quot;:&quot;CET&quot;,&quot;client_ip&quot;:&quot;2003:f8:af01:9e01:b035:2d9a:577:30e2&quot;,&quot;datetime&quot;:&quot;2023-03-07T18:56:37.108448+01:00&quot;,&quot;day_of_week&quot;:2,&quot;day_of_year&quot;:66,&quot;dst&quot;:false,&quot;dst_from&quot;:null,&quot;dst_offset&quot;:0,&quot;dst_until&quot;:null,&quot;raw_offset&quot;:3600,&quot;timezone&quot;:&quot;Europe/Berlin&quot;,&quot;unixtime&quot;:1678211797,&quot;utc_datetime&quot;:&quot;2023-03-07T17:56:37.108448+00:00&quot;,&quot;utc_offset&quot;:&quot;+01:00&quot;,&quot;week_number&quot;:10}
9 :38         Paris         {&quot;abbreviation&quot;:&quot;CET&quot;,&quot;client_ip&quot;:&quot;2003:f8:af01:9e01:b035:2d9a:577:30e2&quot;,&quot;datetime&quot;:&quot;2023-03-07T18:56:38.334731+01:00&quot;,&quot;day_of_week&quot;:2,&quot;day_of_year&quot;:66,&quot;dst&quot;:false,&quot;dst_from&quot;:null,&quot;dst_offset&quot;:0,&quot;dst_until&quot;:null,&quot;raw_offset&quot;:3600,&quot;timezone&quot;:&quot;Europe/Paris&quot;,&quot;unixtime&quot;:1678211798,&quot;utc_datetime&quot;:&quot;2023-03-07T17:56:38.334731+00:00&quot;,&quot;utc_offset&quot;:&quot;+01:00&quot;,&quot;week_number&quot;:10}
10 :39        Amsterdam     {&quot;abbreviation&quot;:&quot;CET&quot;,&quot;client_ip&quot;:&quot;2003:f8:af01:9e01:b035:2d9a:577:30e2&quot;,&quot;datetime&quot;:&quot;2023-03-07T18:56:39.638523+01:00&quot;,&quot;day_of_week&quot;:2,&quot;day_of_year&quot;:66,&quot;dst&quot;:false,&quot;dst_from&quot;:null,&quot;dst_offset&quot;:0,&quot;dst_until&quot;:null,&quot;raw_offset&quot;:3600,&quot;timezone&quot;:&quot;Europe/Amsterdam&quot;,&quot;unixtime&quot;:1678211799,&quot;utc_datetime&quot;:&quot;2023-03-07T17:56:39.638523+00:00&quot;,&quot;utc_offset&quot;:&quot;+01:00&quot;,&quot;week_number&quot;:10}
You see that the time constantly changes for every call. 
(for the `Sleep`, see https://stackoverflow.com/a/41638733/7599798)
</details>

huangapple
  • 本文由 发表于 2023年3月7日 23:12:56
  • 转载请务必保留本文链接:https://go.coder-hub.com/75663773.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定