{"id":717,"date":"2008-05-23T02:02:07","date_gmt":"2008-05-23T02:02:07","guid":{"rendered":"http:\/\/6teen.ru\/?p=746"},"modified":"2008-05-23T02:02:07","modified_gmt":"2008-05-23T02:02:07","slug":"9210","status":"publish","type":"post","link":"http:\/\/pblog.ru\/lab\/?p=717","title":{"rendered":"\u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0430\u0442\u0430\u043c\u0438 \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c"},"content":{"rendered":"<p>\u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0430\u0442\u0430\u043c\u0438 \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c<br \/>\n<!--more--><\/p>\n<pre class=\"alt2\" style=\"margin:0px; padding:6px; border:1px inset; width:580px; height:320px; overflow:auto\"><div>\u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0430\u0442\u0430\u043c\u0438 \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c\n\nfunction Now: TDateTime;\n\n\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0442\u0435\u043a\u0443\u0449\u0443\u044e \u0434\u0430\u0442\u0430\u0443 \u0438 \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u0432\u0430\u0448\u0435\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435. TDateTime \u0432 KOL \u043d\u0438 \u0447\u0435\u043c \u043d\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 VCL \u0430\u043d\u0430\u043b\u043e\u0433\u0430. TDateTime \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0437 \u0441\u0435\u0431\u044f \u0447\u0438\u0441\u043b\u043e \u0441 \u043f\u043b\u0430\u0432\u0430\u044e\u0449\u0435\u0439 \u0437\u0430\u043f\u044f\u0442\u043e\u0439 (\u0442.\u0435. Double), \u0446\u0435\u043b\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0447\u0438\u0441\u043b\u043e \u0434\u043d\u0435\u0439, \u043e\u0442\u0441\u0447\u0438\u0442\u0430\u043d\u043d\u043e\u0435 \u043e\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0430\u0447\u0430\u043b\u0430 \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044f, \u0430 \u0434\u0440\u043e\u0431\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0440\u0430\u0432\u043d\u0430 \u0447\u0430\u0441\u0442\u0438 24-\u0447\u0430\u0441\u043e\u0432\u043e\u0433\u043e \u0434\u043d\u044f, \u0442.\u0435. \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0437\u0443\u0435\u0442 \u0432\u0440\u0435\u043c\u044f \u0438 \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u0434\u0430\u0442\u0435.\n\nfunction CompareSystemTime( const D1, D2: TSystemTime ): Integer;\n\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u0442 2-\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0442\u0438\u043f\u0430 TSystemTime. \u041d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435:\n-1 \u0435\u0441\u043b\u0438 D1 < D2\n0 \u0435\u0441\u043b\u0438 D1 = D2\n1 \u0435\u0441\u043b\u0438 D1 > D2.\nTSystemTime - \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0430\u044f \u0432 Winddows API \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043e \u0434\u0430\u0442\u0430\u0445 \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438. IMHO \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u043e\u043d\u0430 \u0434\u0430\u0436\u0435 \u0443\u0434\u043e\u0431\u043d\u0435\u0439 \u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u044b\u0447\u043d\u043e\u0439 TDateTime.\n\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0439 \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0438 \u0432 Win32.hlp, \u043d\u043e \u0432\u0441\u0435\u0442\u0430\u043a\u0438...\n\u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 : GetSystemTime\n\u0414\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0435\u043d\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0430 \u0432\u0430\u0448\u0435\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435: SetSystemTime\n\n\u041b\u0438\u0441\u0442\u0438\u043d\u0433 1. \u041a\u043e\u0434 Delphi\/Pascal\n\ntype\nPSystemTime = ^TSystemTime;\nTSystemTime = record\nwYear: Word; \/\/ \u0433\u043e\u0434\nwMonth: Word; \/\/ \u043c\u0435\u0441\u0435\u0446\nwDayOfWeek: Word; \/\/ \u0434\u0435\u043d\u044c \u043d\u0435\u0434\u0435\u043b\u0438\nwDay: Word; \/\/ \u0434\u0435\u043d\u044c\nwHour: Word; \/\/ \u0447\u0430\u0441\u044b\nwMinute: Word; \/\/ \u043c\u0438\u043d\u0443\u0442\u044b\nwSecond: Word; \/\/ \u0441\u0435\u043a\u0443\u043d\u0434\u044b\nwMilliseconds: Word; \/\/ \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u044b\nend;\n\nprocedure IncDays( var SystemTime: TSystemTime; DaysNum: Integer );\n\u0423\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u0438\u043b\u0438 \u0443\u043c\u0435\u043d\u044c\u0449\u0430\u0435\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u043d\u0435\u0439 \u0432 \u0437\u0430\u043f\u0438\u0441\u0438 \u0442\u0438\u043f\u0430 TSystemTime. DaysNum \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c.\n\nprocedure IncMonths( var SystemTime: TSystemTime; MonthsNum: Integer );\n\u0423\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u0438\u043b\u0438 \u0443\u043c\u0435\u043d\u044c\u0449\u0430\u0435\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u043d\u0435\u0439 \u0432 \u0437\u0430\u043f\u0438\u0441\u0438 \u0442\u0438\u043f\u0430 TSystemTime. DaysNum \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c. \u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043d\u0435 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u0435\u0441\u043b\u0438 \u0447\u0438\u0441\u043b\u043e \u0434\u043d\u0435\u0439 \u043f\u0440\u0435\u0432\u044b\u0448\u0435\u043d\u043e \u0434\u043b\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043c\u0435\u0441\u044f\u0446\u0430\n\nfunction IsLeapYear( Year: Word ): Boolean;\n\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 true \u0435\u0441\u043b\u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u0433\u043e\u0434 Year \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u044b\u0441\u043e\u043a\u043e\u0441\u043d\u044b\u043c (\u0442\u043e \u0435\u0441\u0442\u044c \u0438\u043c\u0435\u0435\u0442 29 \u0434\u043d\u0435\u0439 \u0432 \u0424\u0435\u0432\u0440\u0430\u043b\u0435).\n\nfunction DayOfWeek( Date: TDateTime ): Integer;\n\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0434\u0435\u043d\u044c \u043d\u0435\u0434\u0435\u043b\u0438 (\u043e\u0442 0 \u0434\u043e 6) \u0434\u043b\u044f \u0442\u0435\u043a\u0443\u0448\u0435\u0439 \u0434\u0430\u0442\u044b.\n\nfunction SystemTime2DateTime( const SystemTime: TSystemTime; var DateTime: TDateTime ): Boolean;\n\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u0434\u0430\u0442\u0443 \u0438\u0437 \u0442\u0438\u043f\u0430 TSystemTime \u0432 TDateTime\n\nfunction DateTime2SystemTime( const DateTime: TDateTime; var SystemTime: TSystemTime ): Boolean;\n\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u0434\u0430\u0442\u0443 \u0438\u0437 \u0442\u0438\u043f\u0430 TDateTime \u0432 TSystemTime.\n\nfunction CatholicEaster( nYear: Integer ): TDateTime;\n\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0434\u0430\u0442\u0443 \u043a\u0430\u0442\u043e\u043b\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0440\u043e\u0436\u0434\u0435\u0441\u0442\u0432\u0430 \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043e\u043c \u0433\u043e\u0434\u0443\n\n\u0411\u043e\u0440\u0438\u0441 \u041c\u043e\u0440\u0435\u043d\u043a\u043e\n<\/div><\/pre>\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0430\u0442\u0430\u043c\u0438 \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[364,436],"tags":[1255,1284,1035],"_links":{"self":[{"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=\/wp\/v2\/posts\/717"}],"collection":[{"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=717"}],"version-history":[{"count":0,"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=\/wp\/v2\/posts\/717\/revisions"}],"wp:attachment":[{"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=717"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=717"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=717"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}