SNTP

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决
1,243 次查看
Microfelix
Contributor IV

hi

 

SNTP. I have some doubts about using the NTP server.


The server returns me the UTC date. Then how do the various time zones in different countries?

 

Maurizio

标签 (1)
标记 (1)
0 项奖励
回复
1 解答
971 次查看
Tim562
Senior Contributor I

I do this by allowing the user to specify the timezone that my product will be running in. For example if the user specifies PST (Pacific Standard Time) then I need to subtract 8 hours from UTC to derive the local time. This can prove to be slightly tricky as you have to handle the rollover of day/month/year boundries yourself (subtracting 8 hours from the UTC time might put you into the previous day, month, year) but nothing too awful.

 

~Tim

在原帖中查看解决方案

0 项奖励
回复
1 回复
972 次查看
Tim562
Senior Contributor I

I do this by allowing the user to specify the timezone that my product will be running in. For example if the user specifies PST (Pacific Standard Time) then I need to subtract 8 hours from UTC to derive the local time. This can prove to be slightly tricky as you have to handle the rollover of day/month/year boundries yourself (subtracting 8 hours from the UTC time might put you into the previous day, month, year) but nothing too awful.

 

~Tim

0 项奖励
回复