{"id":2096,"date":"2014-11-21T04:50:52","date_gmt":"2014-11-20T19:50:52","guid":{"rendered":"http:\/\/www.gisdeveloper.co.kr\/?p=2096"},"modified":"2017-01-31T19:42:27","modified_gmt":"2017-01-31T10:42:27","slug":"c11-%ec%a0%95%eb%b0%80%ed%95%9c-%ec%8b%9c%ea%b0%84-%ec%b8%a1%ec%a0%95%ec%9d%84-%ec%9c%84%ed%95%9c-chrono","status":"publish","type":"post","link":"http:\/\/www.gisdeveloper.co.kr\/?p=2096","title":{"rendered":"[C++11] \uc815\ubc00\ud55c \uc2dc\uac04 \uce21\uc815\uc744 \uc704\ud55c chrono"},"content":{"rendered":"<p><P>\ud558\ub4dc\uc6e8\uc5b4\uc758 \ubc1c\uc804\uc73c\ub85c \ubcf4\ub2e4 \uc815\ubc00\ud55c \uc2dc\uac04\uc744 \uce21\uc815\ud560 \uc218 \uc788\uac8c \ub418\uc5c8\uace0, \uc774\ub97c \uc704\ud574 C++11\uc5d0\uc11c\ub294 chrono\ub97c \uc81c\uacf5\ud569\ub2c8\ub2e4. chrono\ub97c \uc774\uc6a9\ud558\uc5ec \uce21\uc815\ud55c \uc2dc\uac04\uac12\uc758 \uc815\ubc00\ub3c4\ub294 \ub098\ub178(nano, 0.000000001)\ucd08\ub77c\uace0 \ud569\ub2c8\ub2e4. \uc544\ub798\ub294 \ucf54\ub4dc\ub294 \uc5b4\ub5a0\ud55c \uc5f0\uc0b0\uc5d0 \ub300\ud55c \uc18c\uc694 \uc2dc\uac04\uc744 \uce21\uc815\ud558\ub294 \uacbd\uc6b0\ub85c\uc368 chrono\ub97c \uc0ac\uc6a9\ud55c \ucf54\ub4dc\uc785\ub2c8\ub2e4.<\/P><\/p>\n<pre>\r\n#include \"stdafx.h\"\r\n#include <iostream>\r\n#include <chrono>\r\n\r\nusing namespace std;\r\nusing namespace chrono;\r\n\r\nint _tmain(int argc, _TCHAR* argv[])\r\n{\r\n    system_clock::time_point tp1 = system_clock::now();\r\n\t\r\n    double v = 0;\r\n    for(long i = 0; i < 100000000; i++) {\r\n        v += 0.1;\r\n    }\r\n\r\n    system_clock::time_point tp2 = system_clock::now();\r\n\r\n    nanoseconds t = tp2 - tp1;\r\n    cout << \"nanoseconds: \" << t.count() << endl;\r\n    cout << \"seconds: \" << t.count() \/ 1000000000.0 << endl;\r\n\r\n    return 0;\r\n}\r\n<\/pre>\n<p><P>\uc2e4\ud589 \uc2dc\uac04\uc744 \uce21\uc815\ud55c \uc5f0\uc0b0\uc5d0 \ub300\ud55c \ucf54\ub4dc\ub294 12\ubc88 ~ 15\ubc88\uc785\ub2c8\ub2e4. \uc774 \ucf54\ub4dc \ubd80\ubd84\uc758 \uc55e\ub4a4\ub85c chrono\ub97c \uc774\uc6a9\ud558\uc5ec \uc2dc\uac04\uc744 \uce21\uc815\ud558\uace0 \uc788\uc2b5\ub2c8\ub2e4. \uce21\uc815\ub41c \uc2dc\uac04\uc758 \ucc28\uc774(17\ubc88 \ucf54\ub4dc)\ub97c \ud1b5\ud574 \uc5f0\uc0b0\uc5d0 \uc18c\uc694\ub418\ub294 \uc2dc\uac04\uc744 \uc54c \uc218 \uc788\uc2b5\ub2c8\ub2e4. \uc2dc\uac04 \ucc28\uc774\uc5d0 \ub300\ud55c \ub2e8\uc704\ub294 nano\uc774\uba70 \uc774\ub97c \ucd08(second)\ub85c \ubcc0\ud658\ud558\uae30 \uc704\ud574 21\ubc88 \ucf54\ub4dc\ucc98\ub7fc 1000000000\uac12\uc73c\ub85c \ub098\ub204\uc5b4 \ucd9c\ub825\ud558\uace0 \uc788\uc2b5\ub2c8\ub2e4.<\/P><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\ud558\ub4dc\uc6e8\uc5b4\uc758 \ubc1c\uc804\uc73c\ub85c \ubcf4\ub2e4 \uc815\ubc00\ud55c \uc2dc\uac04\uc744 \uce21\uc815\ud560 \uc218 \uc788\uac8c \ub418\uc5c8\uace0, \uc774\ub97c \uc704\ud574 C++11\uc5d0\uc11c\ub294 chrono\ub97c \uc81c\uacf5\ud569\ub2c8\ub2e4. chrono\ub97c \uc774\uc6a9\ud558\uc5ec \uce21\uc815\ud55c \uc2dc\uac04\uac12\uc758 \uc815\ubc00\ub3c4\ub294 \ub098\ub178(nano, 0.000000001)\ucd08\ub77c\uace0 \ud569\ub2c8\ub2e4. \uc544\ub798\ub294 \ucf54\ub4dc\ub294 \uc5b4\ub5a0\ud55c \uc5f0\uc0b0\uc5d0 \ub300\ud55c \uc18c\uc694 \uc2dc\uac04\uc744 \uce21\uc815\ud558\ub294 \uacbd\uc6b0\ub85c\uc368 chrono\ub97c \uc0ac\uc6a9\ud55c \ucf54\ub4dc\uc785\ub2c8\ub2e4. #include &#8220;stdafx.h&#8221; #include #include using namespace std; using namespace chrono; int _tmain(int argc, _TCHAR* argv[]) { system_clock::time_point tp1 = system_clock::now(); double &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/www.gisdeveloper.co.kr\/?p=2096\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;[C++11] \uc815\ubc00\ud55c \uc2dc\uac04 \uce21\uc815\uc744 \uc704\ud55c chrono&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[117,8],"tags":[14],"class_list":["post-2096","post","type-post","status-publish","format-standard","hentry","category-cpp","category-programming","tag-c"],"_links":{"self":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/2096","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2096"}],"version-history":[{"count":1,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/2096\/revisions"}],"predecessor-version":[{"id":2823,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/2096\/revisions\/2823"}],"wp:attachment":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2096"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2096"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2096"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}