{"id":5064,"date":"2019-04-11T11:47:10","date_gmt":"2019-04-11T03:47:10","guid":{"rendered":"http:\/\/blog.qdac.cc\/?p=5064"},"modified":"2019-04-11T11:47:12","modified_gmt":"2019-04-11T03:47:12","slug":"%e6%95%99%e7%a8%8b%e4%bd%bf%e7%94%a8-delphi-%e8%8e%b7%e5%8f%96%e5%bd%93%e5%89%8d%e6%93%8d%e4%bd%9c%e7%b3%bb%e7%bb%9f%e7%9a%84%e6%97%b6%e5%8c%ba","status":"publish","type":"post","link":"https:\/\/blog.qdac.cc\/?p=5064","title":{"rendered":"[\u6559\u7a0b]\u4f7f\u7528 Delphi \u83b7\u53d6\u5f53\u524d\u64cd\u4f5c\u7cfb\u7edf\u7684\u65f6\u533a"},"content":{"rendered":"\n<p>\u55ef\uff0c\u8fd9\u6bb5\u4ee3\u7801\u5b9e\u9645\u4e0a\u5df2\u7ecf\u96c6\u6210\u5230 QString \u5355\u5143\u4e86\uff0c\u6240\u4ee5\u4f60\u53ef\u4ee5\u76f4\u63a5\u8c03\u7528 GetTimezone \u51fd\u6570\u6765\u83b7\u5f97\u65f6\u533a\u4e86\u3002\u7528 GetTimezoneText \u53ef\u4ee5\u83b7\u5f97\u65f6\u533a\u7684\u5b57\u7b26\u4e32\u8868\u793a\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>function GetTimeZone: Integer;\nvar\n{$IFDEF MSWindows}\n  TimeZone: TTimeZoneInformation;\n{$ELSE}\n  tmLocal: TM;\n  t1: time_t;\n{$ENDIF}\nbegin\n{$IFDEF MSWINDOWS}\n  GetTimeZoneInformation(TimeZone);\n  Result := -TimeZone.Bias;\n{$ELSE}\n  t1 := 0;\n  localtime_r(t1, tmLocal);\n  Result := tmLocal.tm_gmtoff div 60 ;\n{$ENDIF}\nend;\n\nfunction GetTimezoneText: QStringW;\nvar\n  ATz: Integer;\nbegin\n  ATz := GetTimeZone;\n  if ATz > 0 then\n    Result := Format('+%.2d%.2d', [ATz div 60, ATz mod 60])\n  else\n  begin\n    ATz := -ATz;\n    Result := Format('-%.2d%.2d', [ATz div 60, ATz mod 60]);\n  end;\nend;<\/code><\/pre>\n\n\n\n<p>\u4ee3\u7801\u4e0d\u957f\uff0c\u7528\u8d77\u6765\u4e5f\u7b80\u5355\uff0c\u5b83\u5b9e\u9645\u4e0a\u8fd4\u56de\u7684\u65f6\u533a\u5bf9\u5e94\u7684\u5206\u949f\u6570\uff0c\u6bd4\u5982\u5317\u4eac\u65f6\u95f4\u662f480\uff0c\u4e5f\u5c31\u662f 8 \u5c0f\u65f6\uff0c\u5176\u5b83\u4f9d\u6b21\u7c7b\u63a8\u3002\u4f7f\u7528 GetTimezonText \u7684\u8bdd\uff0c\u5c31\u4f1a\u8fd4\u56de +0800\u3002\u5c31\u662f\u8fd9\u4e48\u7b80\u5355\u548c\u5b8c\u7f8e\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u55ef\uff0c\u8fd9\u6bb5\u4ee3\u7801\u5b9e\u9645\u4e0a\u5df2\u7ecf\u96c6\u6210\u5230 QStri [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[69,8,603],"tags":[457,150,132,599,768],"class_list":["post-5064","post","type-post","status-publish","format-standard","hentry","category-c-builder","category-delphi","category-603","tag-android","tag-ios","tag-linux","tag-osx","tag-768"],"views":4613,"_links":{"self":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/5064","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5064"}],"version-history":[{"count":1,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/5064\/revisions"}],"predecessor-version":[{"id":5065,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/5064\/revisions\/5065"}],"wp:attachment":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5064"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5064"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5064"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}