{"id":1015,"date":"2009-08-18T10:01:01","date_gmt":"2009-08-18T01:01:01","guid":{"rendered":"https:\/\/www.iss.ai\/?p=1015"},"modified":"2009-08-18T10:01:01","modified_gmt":"2009-08-18T01:01:01","slug":"%e6%b0%97%e3%81%be%e3%81%90%e3%82%8c-programming-tips-%e3%80%90%ef%bc%92%e3%80%91","status":"publish","type":"post","link":"https:\/\/www.iss.ai\/?p=1015","title":{"rendered":"\u6c17\u307e\u3050\u308c Programming TIPS \u3010\uff12\u3011"},"content":{"rendered":"\t\t\t\t<p>\u3010\uff12\u3011\u3000\u73fe\u5728\u6642\u523b\u306e\u53d6\u5f97(C)<\/p>\n\t\t\t\t<p>\u6c17\u307e\u3050\u308c\u306b\u601d\u3044\u3064\u3044\u305f\u5185\u5bb9\u3092\u3001\u5099\u5fd8\u9332\u7684\u306b\u6bb4\u308a\u66f8\u304f\u3082\u306e\u3067\u3054\u3056\u3044\u307e\u3059\u3002<\/p>\n\t\t\t\t<p>\u4eca\u56de\u306f\u73fe\u5728\u6642\u523b\u3092\u53d6\u5f97\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u3002<br \/>\n\t\t\t\t\u73fe\u5728\u6642\u523b\u3092\u53d6\u5f97\u3059\u308b\u306b\u306f\u3001\u6a19\u6e96C\u30e9\u30a4\u30d6\u30e9\u30ea\u306etime\u95a2\u6570\u3092\u4f7f\u3044\u307e\u3059\u3002<\/p>\n\t\t\t\t<p>time_t time(time_t *time);<\/p>\n\t\t\t\t<p>\u5f15\u6570time\u306f\u6642\u523b\u306e\u683c\u7d0d\u5834\u6240\u3078\u306e\u30dd\u30a4\u30f3\u30bf\u3002<br \/>\n\t\t\t\t\u623b\u308a\u5024\u306f1970\u5e741\u67081\u65e50\u6642\u4ee5\u964d\u306e\u7d4c\u904e\u79d2\u6570\u3002<\/p>\n\t\t\t\t<p>time\u95a2\u6570\u3067\u53d6\u5f97\u3067\u304d\u308b\u30b7\u30b9\u30c6\u30e0\u6642\u523b\u306f\u3001\u7d4c\u904e\u79d2\u6570\u306a\u306e\u3067\u308f\u304b\u308a\u3084\u3059\u3044\u5f62\u306b\u5909\u63db\u3059\u308b\u3002<\/p>\n\t\t\t\t<p>struct tm *localtime(const time_t time);<\/p>\n\t\t\t\t<p>tm\u69cb\u9020\u4f53\u306e\u30e1\u30f3\u30d0\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3001<br \/>\n\t\t\t\ttm_sec &#8211; \u79d2(0~59)<br \/>\n\t\t\t\ttm_min &#8211; \u5206(0~59)<br \/>\n\t\t\t\ttm_hour &#8211; \u6642\u9593(0~23)<br \/>\n\t\t\t\ttm_mday &#8211; \u65e5(1~31)<br \/>\n\t\t\t\ttm_mon &#8211; \u6708(0~11\u30011\u6708=0)<br \/>\n\t\t\t\ttm_year &#8211; \u5e74(\u5b9f\u969b\u306e\u897f\u66a6\u304b\u30891900\u3092\u5f15\u3044\u305f\u6570)<br \/>\n\t\t\t\ttm_wday &#8211; \u66dc\u65e5(0~6\u3001\u65e5\u66dc\u65e5=0)<br \/>\n\t\t\t\ttm_yday &#8211; \u5e74\u5185\u306e\u901a\u7523\u65e5(0~365\u30011\u67081\u65e5=0)<br \/>\n\t\t\t\ttm_isdst &#8211; \u590f\u6642\u9593\u304c\u6709\u52b9\u306a\u5834\u5408\u306f\u6b63\u306e\u5024\u3001\u590f\u6642\u9593\u304c\u7121\u52b9\u306a\u5834\u5408\u306f0\u3001\u590f\u6642\u9593\u304c\u3069\u3046\u304b\u304c\u4e0d\u660e\u306a\u5834\u5408\u306f\u8ca0\u306e\u5024<\/p>\n\t\t\t\t<p>time\u95a2\u6570\u3067\u53d6\u5f97\u3057\u305ftime_t\u5909\u6570\u3092localtime\u95a2\u6570\u306b\u6e21\u3059\u3068\u3001<br \/>\n\t\t\t\t\u30bf\u30a4\u30e0\u30be\u30fc\u30f3\u306b\u5408\u308f\u305b\u3066tm\u69cb\u9020\u4f53\u306b\u5909\u63db\u3055\u308c\u308b\u3002<\/p>\n\t\t\t\t<p>\u4ee5\u4e0b\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9<\/p>\n\t\t\t\t<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">  char week&#x5B;7]&#x5B;3] = {&quot;\u65e5&quot;,&quot;\u6708&quot;,&quot;\u706b&quot;,&quot;\u6c34&quot;,&quot;\u6728&quot;,&quot;\u91d1&quot;,&quot;\u571f&quot;};  time_t time_now; struct tm  *local;  time(&amp;time_now); local = localtime(&amp;time_now);  printf(&quot;%d\u5e74%02d\u6708%02d\u65e5(%s)\\n&quot;,local-&gt;tm_year+1900,local-&gt;tm_mon+1,local-&gt;tm_mday,week&#x5B;local-&gt;tm_wday]); printf(&quot;%02d\u6642%02d\u5206%02d\u79d2\\n&quot;, local-&gt;tm_hour, local-&gt;tm_min, local-&gt;tm_sec);  <\/pre>\n<p>\u5b9f\u884c\u7d50\u679c<br \/>\n2009\u5e7408\u670817\u65e5(\u6708)<br \/>\n14\u664202\u520615\u79d2<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3010\uff12\u3011\u3000\u73fe\u5728\u6642\u523b\u306e\u53d6\u5f97(C) \u6c17\u307e\u3050\u308c\u306b\u601d\u3044\u3064\u3044\u305f\u5185\u5bb9\u3092\u3001\u5099\u5fd8\u9332\u7684\u306b\u6bb4\u308a\u66f8\u304f\u3082\u306e\u3067\u3054\u3056\u3044\u307e\u3059\u3002 \u4eca\u56de\u306f\u73fe\u5728\u6642\u523b\u3092\u53d6\u5f97\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u3002 \u73fe\u5728\u6642\u523b\u3092\u53d6\u5f97\u3059\u308b\u306b\u306f\u3001\u6a19\u6e96C\u30e9\u30a4\u30d6\u30e9\u30ea\u306etime\u95a2\u6570\u3092\u4f7f\u3044\u307e\u3059\u3002 time_t t [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,3],"tags":[22],"class_list":["post-1015","post","type-post","status-publish","format-standard","hentry","category-soft","category-tech","tag-programming-tips"],"_links":{"self":[{"href":"https:\/\/www.iss.ai\/index.php?rest_route=\/wp\/v2\/posts\/1015","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.iss.ai\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.iss.ai\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.iss.ai\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.iss.ai\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1015"}],"version-history":[{"count":25,"href":"https:\/\/www.iss.ai\/index.php?rest_route=\/wp\/v2\/posts\/1015\/revisions"}],"predecessor-version":[{"id":1047,"href":"https:\/\/www.iss.ai\/index.php?rest_route=\/wp\/v2\/posts\/1015\/revisions\/1047"}],"wp:attachment":[{"href":"https:\/\/www.iss.ai\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1015"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.iss.ai\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1015"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.iss.ai\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1015"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}