{"id":523,"date":"2008-04-21T15:45:52","date_gmt":"2008-04-21T15:45:52","guid":{"rendered":"http:\/\/pchero21.com\/?p=523"},"modified":"2008-04-21T15:45:52","modified_gmt":"2008-04-21T15:45:52","slug":"time-%ea%b3%bc-localtime","status":"publish","type":"post","link":"http:\/\/pchero21.com\/?p=523","title":{"rendered":"time() \uacfc localtime()"},"content":{"rendered":"<p>\n\ub9ac\ub205\uc2a4\uc5d0\uc11c \ub144, \uc6d4, \uc77c, \uc2dc, \ubd84, \ucd08 \ub85c \ub098\ud0c0\ub0b4\ub294 \ud568\uc218\ub85c<\/p>\n<p>time, localtime \uc788\ub2e4.<\/p>\n<h1><a name=\"AEN1\">1\uc7a5. <\/a><a href=\"http:\/\/www.joinc.co.kr\/modules\/moniwiki\/wiki.php\/manSearch?google=none&amp;name=localtime\">localtime<\/a>(3)<\/h1>\n<div class=\"TOC\">\n<dl>\n<dt><b>\ucc28\ub840<\/b><\/dt>\n<dt>1.1\uc808. <a href=\"http:\/\/www.joinc.co.kr\/modules\/moniwiki\/wiki.php\/man\/3\/localtime#AEN4\">\uc0ac\uc6a9\ubc95<\/a><\/dt>\n<dt>1.2\uc808. <a href=\"http:\/\/www.joinc.co.kr\/modules\/moniwiki\/wiki.php\/man\/3\/localtime#AEN8\">\uc124\uba85<\/a><\/dt>\n<dt>1.3\uc808. <a href=\"http:\/\/www.joinc.co.kr\/modules\/moniwiki\/wiki.php\/man\/3\/localtime#AEN13\">\ubc18\ud658\uac12<\/a><\/dt>\n<dt>1.4\uc808. <a href=\"http:\/\/www.joinc.co.kr\/modules\/moniwiki\/wiki.php\/man\/3\/localtime#AEN16\">\uc608\uc81c<\/a><\/dt>\n<\/dl>\n<\/div>\n<div class=\"SECTION\">\n<hr>\n<h1 class=\"SECTION\"><a name=\"AEN4\">1.1\uc808. \uc0ac\uc6a9\ubc95<\/a><\/h1>\n<\/p>\n<table bgcolor=\"#e0e0e0\" border=\"0\" width=\"100%\">\n<tbody>\n<tr>\n<td>\n<pre class=\"SCREEN\">#include &lt;time.h&gt;<br \/><br \/>struct tm *<a href=\"http:\/\/www.joinc.co.kr\/modules\/moniwiki\/wiki.php\/manSearch?google=none&amp;name=localtime\">localtime<\/a>(const time_t *timep);<br \/>\t\t<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table><\/div>\n<div class=\"SECTION\">\n<hr>\n<h1 class=\"SECTION\"><a name=\"AEN8\">1.2\uc808. \uc124\uba85<\/a><\/h1>\n<p>\t\ttimep \ub97c \uc785\ub825\ubc1b\uc544\uc11c \uc720\uc800 \uc2dc\uc2a4\ud15c\uc758 time zone \uc5d0 \ub9de\ub3c4\ub85d<br \/>\n\t\t\uc2dc\uac04 \uac12\uc744 \ub3cc\ub824\uc900\ub2e4. \uc2dc\uac04 \uac12\uc740 tm \uad6c\uc870\uccb4\uc5d0 \ub4e4\uc5b4\uac04\ub2e4.<br \/>\n\t\ttm \uad6c\uc870\uccb4\ub294 \ub2e4\uc74c\uacfc \uac19\uc740 \uba64\ubc84 \ubcc0\uc218\ub4e4\uc744 \ud3ec\ud568\ud55c\ub2e4.\n\t\t<\/p>\n<table bgcolor=\"#e0e0e0\" border=\"0\" width=\"100%\">\n<tbody>\n<tr>\n<td>\n<pre class=\"SCREEN\">struct tm<br \/>{<br \/>        int     tm_sec;         \/* \ucd08 *\/ <br \/>        int     tm_min;         \/* \ubd84 *\/<br \/>        int     tm_hour;        \/* \uc2dc\uac04 *\/<br \/>        int     tm_mday;        \/* \uc77c\/\uc6d4 *\/<br \/>        int     tm_mon;         \/* \uc6d4 *\/<br \/>        int     tm_year;        \/* \ub144 *\/<br \/>        int     tm_wday;        \/* \uc77c\/\uc8fc *\/<br \/>        int     tm_yday;        \/* \uc77c\/\ub144 *\/<br \/>        int     tm_isdst;       \/* \uc12c\ub9c8\ud0c0\uc784 *\/<br \/>};<br \/>\t\t<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\t\t\uc6d4\uc740 0\ubd80\ud130 \uc2dc\uc791\ud55c\ub2e4. \uadf8\ub7ec\ubbc0\ub85c \ud504\ub85c\uadf8\ub7a8\uc0c1\uc5d0\uc11c \uc81c\ub300\ub85c \ud45c\ud604\ud558\ub824\uba74 +1\uc744<br \/>\n\t\t\ud574\uc8fc\uc5b4\uc57c \ud55c\ub2e4. \ub610\ud55c \ub144\uc758 \uacbd\uc6b0\uc5d0\ub294 +1900 \ud574\uc8fc\uc5b4\uc57c \ud55c\ub2e4.  <\/p>\n<p>\t\t\uc544\uaddc\uba3c\ud2b8\ub85c \ub4e4\uc5b4\uac00\ub294 timeptr \uc740 1970\ub144 1\uc6d4 1\uc77c 00:00:00 \ubd80\ud130\uc758<br \/>\n\t\t\uacc4\uc0b0\ud558\uace0\ud508 \ub54c\uae4c\uc9c0\uc758 \uc2dc\uac04\uc758 \ucc28\uc774\ub97c \ucd08\ub85c \ud658\uc0b0\ud55c \uac12\uc774\ub2e4.\n\t<\/p>\n<\/div>\n<div class=\"SECTION\">\n<hr>\n<h1 class=\"SECTION\"><a name=\"AEN13\">1.3\uc808. \ubc18\ud658\uac12<\/a><\/h1>\n<p>\t\ttm \uad6c\uc870\uccb4\ub97c \ub118\uaca8\uc900\ub2e4.\n\t<\/p>\n<\/div>\n<hr>\n<h1 class=\"SECTION\"><a name=\"AEN16\">1.4\uc808. \uc608\uc81c<\/a><\/h1>\n<table bgcolor=\"#e0e0e0\" border=\"0\" width=\"100%\">\n<tbody>\n<tr>\n<td>\n<pre class=\"SCREEN\">#include &lt;time.h&gt;<br \/><br \/>#include &lt;stdio.h&gt;<br \/>#include &lt;sys\/types.h&gt;<br \/>#include &lt;unistd.h&gt;<br \/><br \/>void <a href=\"http:\/\/www.joinc.co.kr\/modules\/moniwiki\/wiki.php\/manSearch?google=none&amp;name=swaptime\">swaptime<\/a>(time_t, char *);<br \/>int <a href=\"http:\/\/www.joinc.co.kr\/modules\/moniwiki\/wiki.php\/manSearch?google=none&amp;name=main\">main<\/a>()<br \/>{<br \/>    char buffer[255];<br \/>    time_t the_time;<br \/><br \/>    \/\/ time \ud568\uc218\ub97c \uc774\uc6a9\ud574\uc11c \ud604\uc7ac \uc2dc\uac04\uc744 \uc5bb\uc5b4\uc628\ub2e4. <br \/>    <a href=\"http:\/\/www.joinc.co.kr\/modules\/moniwiki\/wiki.php\/manSearch?google=none&amp;name=time\">time<\/a>(&amp;the_time);<br \/><br \/>    <a href=\"http:\/\/www.joinc.co.kr\/modules\/moniwiki\/wiki.php\/manSearch?google=none&amp;name=memset\">memset<\/a>(buffer, 0x00, 255);<br \/>    <a href=\"http:\/\/www.joinc.co.kr\/modules\/moniwiki\/wiki.php\/manSearch?google=none&amp;name=swaptime\">swaptime<\/a>(the_time, buffer);<br \/>    printf(\"%sn\", buffer);<br \/>}<br \/><br \/>void <a href=\"http:\/\/www.joinc.co.kr\/modules\/moniwiki\/wiki.php\/manSearch?google=none&amp;name=swaptime\">swaptime<\/a>(time_t org_time, char *time_str)<br \/>{<br \/>    struct tm *tm_ptr;<br \/>    tm_ptr = <a href=\"http:\/\/www.joinc.co.kr\/modules\/moniwiki\/wiki.php\/manSearch?google=none&amp;name=localtime\">localtime<\/a>(&amp;org_time);<br \/><br \/>    sprintf(time_str, \"%d-%d-%d %d:%d:%d\", tm_ptr-&gt;tm_year+1900,<br \/>                    tm_ptr-&gt;tm_mon+1,<br \/>                    tm_ptr-&gt;tm_mday,<br \/>                    tm_ptr-&gt;tm_hour,<br \/>                    tm_ptr-&gt;tm_min,<br \/>                    tm_ptr-&gt;tm_sec);<br \/><br \/>}<br \/>\t\t<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\t\t\uc704 \ud504\ub85c\uadf8\ub7a8\uc744 \ucef4\ud30c\uc77c\ud55c\ub2e4\uc74c \uc2e4\ud589\uc2dc\ud0a4\uba74 \ub2e4\uc74c\uacfc \uac19\uc740 \uacb0\uacfc\ub97c \ubcf4\uc5ec\uc904\uac83\uc774\ub2e4. <\/p>\n<pre class=\"SCREEN\">[root@localhost test]# .\/localtime<br \/>2002-8-23 18:18:32<br \/><br \/><br \/>\ucd9c\ucc98 : <a href=\"http:\/\/www.joinc.co.kr\/modules\/moniwiki\/wiki.php\/man\/3\/localtime\" target=\"_blank\">http:\/\/www.joinc.co.kr\/modules\/moniwiki\/wiki.php\/man\/3\/localtime<\/a><\/pre>\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\ub9ac\ub205\uc2a4\uc5d0\uc11c \ub144, \uc6d4, \uc77c, \uc2dc, \ubd84, \ucd08 \ub85c \ub098\ud0c0\ub0b4\ub294 \ud568\uc218\ub85c time, localtime \uc788\ub2e4. 1\uc7a5. localtime(3) \ucc28\ub840 1.1\uc808. \uc0ac\uc6a9\ubc95 1.2\uc808. \uc124\uba85 1.3\uc808. \ubc18\ud658\uac12 1.4\uc808. \uc608\uc81c 1.1\uc808. \uc0ac\uc6a9\ubc95 #include &lt;time.h&gt;struct tm *localtime(const time_t *timep); 1.2\uc808. \uc124\uba85 timep \ub97c \uc785\ub825\ubc1b\uc544\uc11c \uc720\uc800 \uc2dc\uc2a4\ud15c\uc758 time &hellip; <a href=\"http:\/\/pchero21.com\/?p=523\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[40],"tags":[244,384],"_links":{"self":[{"href":"http:\/\/pchero21.com\/index.php?rest_route=\/wp\/v2\/posts\/523"}],"collection":[{"href":"http:\/\/pchero21.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/pchero21.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/pchero21.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/pchero21.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=523"}],"version-history":[{"count":0,"href":"http:\/\/pchero21.com\/index.php?rest_route=\/wp\/v2\/posts\/523\/revisions"}],"wp:attachment":[{"href":"http:\/\/pchero21.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=523"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/pchero21.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=523"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/pchero21.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=523"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}