{"id":10871,"date":"2021-09-10T08:55:47","date_gmt":"2021-09-10T00:55:47","guid":{"rendered":"https:\/\/www.bookcard.net\/wordpress\/?p=10871"},"modified":"2021-09-12T11:38:15","modified_gmt":"2021-09-12T03:38:15","slug":"android_studio_ndk_temp","status":"publish","type":"post","link":"https:\/\/www.bookcard.net\/wordpress\/android_studio_ndk_temp\/","title":{"rendered":"Android Studio NDK \u65e5\u671f\u6642\u9593"},"content":{"rendered":"<figure id=\"attachment_10872\" aria-describedby=\"caption-attachment-10872\" style=\"width: 1280px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2021\/09\/Android_Studio_NDK_temp.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-10872\" src=\"https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2021\/09\/Android_Studio_NDK_temp.jpg\" alt=\"Android Studio NDK \u65e5\u671f\u6642\u9593\" width=\"1280\" height=\"800\" srcset=\"https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2021\/09\/Android_Studio_NDK_temp.jpg 1280w, https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2021\/09\/Android_Studio_NDK_temp-300x188.jpg 300w, https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2021\/09\/Android_Studio_NDK_temp-768x480.jpg 768w\" sizes=\"auto, (max-width: 1280px) 100vw, 1280px\" \/><\/a><figcaption id=\"caption-attachment-10872\" class=\"wp-caption-text\">Android Studio NDK \u65e5\u671f\u6642\u9593<\/figcaption><\/figure>\n<p>Android \u6240\u7528C\/C++\u5eabBionic API. \u5373\u8f15\u91cf\u7d1aC\/C++\u5eab. \u520632\u4f4d\u540c64\u4f4d, 32\u4f4d\u300etime_t\u300f\u6709\u6548\u671f\u81f32038\u5e74, 64\u4f4d\u300e__time64_t\u300f\u6709\u6548\u671f\u81f33000\u5e74.<\/p>\n<p>\u544c\u300etm\u300f\u6642\u9593\u7d50\u69cb<\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"189\">struct tm {<\/td>\n<td width=\"387\">\u7d50\u69cb\u6642\u9593<\/td>\n<\/tr>\n<tr>\n<td width=\"189\">int tm_sec;<\/td>\n<td width=\"387\">\u79d2\u9418[0~59]<\/td>\n<\/tr>\n<tr>\n<td width=\"189\">int tm_min;<\/td>\n<td width=\"387\">\u5206\u9418[0~59]<\/td>\n<\/tr>\n<tr>\n<td width=\"189\">int tm_hour;<\/td>\n<td width=\"387\">\u6642\u9418[0~23]<\/td>\n<\/tr>\n<tr>\n<td width=\"189\">int tm_mday;<\/td>\n<td width=\"387\">\u865f[1~31]<\/td>\n<\/tr>\n<tr>\n<td width=\"189\">int tm_mon;<\/td>\n<td width=\"387\">\u6708\u4efd[0~11] \u9700\u52a01<\/td>\n<\/tr>\n<tr>\n<td width=\"189\">int tm_year;<\/td>\n<td width=\"387\">\u5e74\u4efd\u9700\u52a01900, \u5112\u7565\u6b74<\/td>\n<\/tr>\n<tr>\n<td width=\"189\">int tm_wday;<\/td>\n<td width=\"387\">\u79ae\u62dc[0~1],\u79ae\u62dc\u65e5Sunday=0<\/td>\n<\/tr>\n<tr>\n<td width=\"189\">int tm_yday;<\/td>\n<td width=\"387\">\u5929[0~365],1\u67081\u865f=0<\/td>\n<\/tr>\n<tr>\n<td width=\"189\">int tm_isdst;<\/td>\n<td width=\"387\">\u590f\u4ee4\u6642\u70ba\u6b63, \u5426<\/td>\n<\/tr>\n<tr>\n<td width=\"189\">long int tm_gmtoff;<\/td>\n<td width=\"387\">\u7576\u524d\u6642\u76f8\u5c0dUTC\u5f80\u6771\u6642\u5dee,\u5373\u6771\u7232\u6b63\u897f\u7232\u8ca0.<\/td>\n<\/tr>\n<tr>\n<td width=\"189\">const char* tm_zone;};<\/td>\n<td width=\"387\">\u6642\u5340\u7e2e\u5beb<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4fc2\u300eWin32 API\u300f\u4f60\u9700time()\/_time64()\u7372\u5f97\u6642\u9593, \u518d\u849elocaltime()\/_localtime64()\u6839\u64da\u6642\u5340\u8f49\u7232\u672c\u5730\u6642\u9593\u300etm\u300f<\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"575\">Win32\u00a0 API\u7248\u672c<\/td>\n<\/tr>\n<tr>\n<td width=\"575\">char time_text[280];<\/p>\n<p>struct tm\u00a0\u00a0 temp_str;\/\/ \u6642\u9593\u7d50\u6784<\/p>\n<p>__time64_t\u00a0 temp_int;\/\/ \u6642\u9593\u6574\u6570<\/p>\n<p>_time64(&amp;temp_int);\/\/ \u83b7\u53d6\u6642\u9593<\/p>\n<p>_localtime64_s(&amp;temp_str ,&amp;temp_int);\/\/ \u6839\u636e\u6642\u5340\u8f49\u70ba\u672c\u5730\u6642\u9593<\/p>\n<p>sprintf(time_text, &#8220;%4d-%02d-%02d %02d:%02d:%02d&#8221;,<\/p>\n<p>1900+temp_str.tm_year,1+temp_str.tm_mon, temp_str.tm_mday,<\/p>\n<p>temp_str.tm_hour,temp_str.tm_min,temp_str.tm_sec);<\/td>\n<\/tr>\n<tr>\n<td width=\"575\">2021-09-09 23:43:08<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Android Studio NDK \u300eBionic API\u300f\u7248\u672c,\u53ef\u7528localtime_r()\u6839\u64da\u6642\u5340\u7372\u5f97\u672c\u5730\u6642\u9593\u300etm\u300f<\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"575\">Bionic API\u7248\u672c<\/td>\n<\/tr>\n<tr>\n<td width=\"575\">\u00a0\u00a0\u00a0 char time_text[280];\/\/ \u6642\u9593\u6587\u672c<\/p>\n<p>struct tm\u00a0 temp_str;\/\/ \u6642\u9593\u7d50\u69cb<\/p>\n<p>time_t temp_int;\/\/ 32\u4f4d\u6642\u9593\u6574\u6578<\/p>\n<p>temp_int = time(0);<\/p>\n<p>localtime_r(&amp;temp_int,&amp;temp_str);\/\/ \u6839\u64da\u6642\u5340\u8f49\u7232\u672c\u5730\u6642\u9593<\/p>\n<p>sprintf(time_text, &#8220;%04d-%02d-%02d %02d:%02d:%02d&#8221;,<\/p>\n<p>1900+temp_str.tm_year,1+temp_str.tm_mon, temp_str.tm_mday,<\/p>\n<p>temp_str.tm_hour,temp_str.tm_min,temp_str.tm_sec);<\/td>\n<\/tr>\n<tr>\n<td width=\"575\">2021-09-09 23:43:08<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Android \u6240\u7528C\/C++\u5eabBionic API. \u5373\u8f15\u91cf\u7d1aC\/C++\u5eab. \u520632\u4f4d\u540c64\u4f4d, 32\u4f4d\u300et &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.bookcard.net\/wordpress\/android_studio_ndk_temp\/\" class=\"more-link\">\u7e7c\u7e8c\u95b1\u8b80 <span class=\"screen-reader-text\">Android Studio NDK \u65e5\u671f\u6642\u9593<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,13],"tags":[2,42],"class_list":["post-10871","post","type-post","status-publish","format-standard","hentry","category-android","category-pc","tag-android","tag-computer","entry"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/posts\/10871","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/comments?post=10871"}],"version-history":[{"count":4,"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/posts\/10871\/revisions"}],"predecessor-version":[{"id":10886,"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/posts\/10871\/revisions\/10886"}],"wp:attachment":[{"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/media?parent=10871"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/categories?post=10871"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/tags?post=10871"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}