{"id":322311,"date":"2021-04-29T15:00:16","date_gmt":"2021-04-29T15:00:16","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=322311"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=322311","title":{"rendered":"R \u0438 \u0440\u0430\u0431\u043e\u0442\u0430 \u0441\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c. \u0427\u0442\u043e \u0437\u0430 \u043a\u0443\u043b\u0438\u0441\u0430\u043c\u0438?"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\n<p>\u0414\u0430\u0442\u044b \u0438 \u0432\u0440\u0435\u043c\u044f \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432\u0435\u0441\u044c\u043c\u0430 \u043d\u0435\u043f\u0440\u043e\u0441\u0442\u044b\u043c\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u043c\u0435\u0441\u044f\u0446\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0434\u043d\u0435\u0439;<\/li>\n<li>\u0433\u043e\u0434\u0430 \u0431\u044b\u0432\u0430\u044e\u0442 \u0432\u0438\u0441\u043e\u043a\u043e\u0441\u043d\u044b\u043c\u0438 \u0438 \u043d\u0435\u0442;<\/li>\n<li>\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u042b\u0435 \u0437\u043e\u043d\u044b;<\/li>\n<li>\u0447\u0430\u0441\u044b, \u043c\u0438\u043d\u0443\u0442\u044b, \u0434\u043d\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0441\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u0440\u044f\u0434 \u043c\u043e\u043c\u0435\u043d\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0435\u0434\u043a\u043e \u0432\u044b\u0441\u0432\u0435\u0447\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0442\u0440\u044e\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043f\u0438\u0441\u0430\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u0435\u043c\u044b\u0439 \u043a\u043e\u0434.<\/p>\n<p>  <\/p>\n<p>\u0421\u043e\u0432\u0441\u0435\u043c \u043a\u0440\u0430\u0442\u043a\u043e\u0435 \u0440\u0435\u0437\u044e\u043c\u0435 \u0434\u043b\u044f \u0441\u043c\u0430\u0440\u0442\u0444\u043e\u043d\u043e\u0447\u0438\u0442\u0430\u043b\u0435\u0439: \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043c\u0430\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e <code>POSIXct<\/code> \u0441 \u0434\u0440\u043e\u0431\u043d\u044b\u043c\u0438 \u0434\u043e\u043b\u044f\u043c\u0438 \u0441\u0435\u043a\u0443\u043d\u0434. \u0411\u0443\u0434\u0435\u0442 \u0445\u043e\u0440\u043e\u0448\u043e, \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0431\u044b\u0441\u0442\u0440\u043e.<\/p>\n<p>  <\/p>\n<p>\u042f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435\u043c <a href=\"https:\/\/habrahabr.ru\/users\/i_shutov\/posts\/\" rel=\"nofollow noopener noreferrer\">\u0441\u0435\u0440\u0438\u0438 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0439<\/a>.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h1 id=\"standarty-dlya-specificirovaniya-dat-i-vremeni\">\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u044b \u0434\u043b\u044f \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u0442 \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438<\/h1>\n<p>  <\/p>\n<p><a href=\"https:\/\/en.wikipedia.org\/wiki\/ISO_8601\" rel=\"nofollow noopener noreferrer\">ISO 8601 Data elements and interchange formats<\/a> \u2013 Information interchange \u2013 Representation of dates and times is an international standard covering the exchange of date- and time-related data.<\/p>\n<p>  <\/p>\n<h1 id=\"bazovye-metody-dlya-raboty-s-datoy\">\u0411\u0430\u0437\u043e\u0432\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0430\u0442\u043e\u0439<\/h1>\n<p>  <\/p>\n<h2 id=\"data\">\u0414\u0430\u0442\u0430<\/h2>\n<p>  <\/p>\n<pre><code class=\"python\">Sys.Date() print(&quot;-----&quot;)  x &lt;- as.Date(&quot;2019-01-29&quot;) # \u0432 UTC print(x) tz(x) str(x) dput(x)  print(&quot;-----&quot;) dput(as.Date(&quot;1970-01-01&quot;)) # ! origin<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0412\u044b\u0432\u043e\u0434 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"plaintext\">## [1] &quot;2021-04-29&quot; ## [1] &quot;-----&quot; ## [1] &quot;2019-01-29&quot; ## [1] &quot;UTC&quot; ##  Date[1:1], format: &quot;2019-01-29&quot; ## structure(17925, class = &quot;Date&quot;) ## [1] &quot;-----&quot; ## structure(0, class = &quot;Date&quot;)<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<p>\u041d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u0434\u0430\u0442\u044b \u043f\u0440\u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">as.Date(&quot;04\/20\/2011&quot;, format = &quot;%m\/%d\/%Y&quot;)<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"plaintext\">## [1] &quot;2011-04-20&quot;<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"vremya\">\u0412\u0440\u0435\u043c\u044f<\/h2>\n<p>  <\/p>\n<p>\u0412 R \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0434\u0432\u0430 \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u0442\u0438\u043f\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438: <code>POSIXct<\/code> \u0438 <code>POSIXlt<\/code>.<br \/>  \u0412\u043d\u0435\u0448\u043d\u0438\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f <code>POSIXct<\/code> \u0438 <code>POSIXlt<\/code> \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u043f\u043e\u0445\u043e\u0436\u0438\u043c\u0438. \u0410 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435?<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">z &lt;- Sys.time() glue(&quot;\u0412\u043d\u0435\u0448\u043d\u0435\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435&quot;,       &quot;POSIXct - {z}&quot;,       &quot;POSIXlt - {as.POSIXlt(z)}&quot;, &quot;---&quot;, .sep = &quot;\\n&quot;)  glue(&quot;\u0412\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435&quot;,       &quot;POSIXct - {capture.output(dput(z))}&quot;,       &quot;POSIXlt - {paste0(capture.output(dput(as.POSIXlt(z))), collapse = '')}&quot;,      &quot;---&quot;, .sep = &quot;\\n&quot;)  # \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u0430\u0442\u044b\/\u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0431\u0430\u0437\u043e\u0432\u044b\u043c\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 glue(&quot;\u0413\u043e\u0434: {year(z)} \\n\u041c\u0438\u043d\u0443\u0442\u044b: {minute(z)}\\n\u0421\u0435\u043a\u0443\u043d\u0434\u044b: {second(z)}\\n---&quot;)<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0412\u044b\u0432\u043e\u0434 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"plaintext\">## \u0412\u043d\u0435\u0448\u043d\u0435\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 ## POSIXct - 2021-04-29 15:18:04 ## POSIXlt - 2021-04-29 15:18:04 ## --- ## \u0412\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 ## POSIXct - structure(1619698684.50764, class = c(&quot;POSIXct&quot;, &quot;POSIXt&quot;)) ## POSIXlt - structure(list(sec = 4.50764489173889, min = 18L, hour = 15L,     mday = 29L, mon = 3L, year = 121L, wday = 4L, yday = 118L,     isdst = 0L, zone = &quot;MSK&quot;, gmtoff = 10800L), class = c(&quot;POSIXlt&quot;, &quot;POSIXt&quot;), tzone = c(&quot;&quot;, &quot;MSK&quot;, &quot;MSD&quot;)) ## --- ## \u0413\u043e\u0434: 2021  ## \u041c\u0438\u043d\u0443\u0442\u044b: 18 ## \u0421\u0435\u043a\u0443\u043d\u0434\u044b: 4 ## ---<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<p>\u0421\u0440\u0430\u0437\u0443 \u0434\u0435\u043b\u0430\u0435\u043c \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u0434\u043b\u044f \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 (\u0431\u043e\u043b\u0435\u0435 10 \u0441\u0442\u0440\u043e\u043a \u0441 \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c), \u043f\u0440\u043e <code>POSIXlt<\/code> \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u043a\u0430\u043a \u043f\u0440\u043e \u0441\u0442\u0440\u0430\u0448\u043d\u044b\u0439 \u0441\u043e\u043d.<\/p>\n<p>  <\/p>\n<p><code>POSIXct<\/code> \u043f\u043e \u0441\u0432\u043e\u0435\u0439 \u0441\u0443\u0442\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u0435\u0440\u0442\u043a\u043e\u0439 \u0434\u043b\u044f unixtimestamp, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0435\u043a\u0443\u043d\u0434 (\u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434) \u0441 \u043d\u0435\u043a\u043e\u0435\u0439 \u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 (\u043e\u0431\u044b\u0447\u043d\u043e \u0437\u0430 0 \u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442 01.01.1970). \u0414\u0435\u043b\u0430\u0435\u043c \u0441\u0442\u0430\u0432\u043a\u0443 \u0432 \u0440\u0430\u0431\u043e\u0442\u0435 \u0438\u043c\u0435\u043d\u043d\u043e \u043d\u0430 \u043d\u0435\u0433\u043e.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u2014 online \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432 unixtimestamp:<\/p>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/www.unixtimestamp.com\/\" rel=\"nofollow noopener noreferrer\">Epoch Unix Time Stamp Converter<\/a><\/li>\n<li><a href=\"https:\/\/www.epochconverter.com\/\" rel=\"nofollow noopener noreferrer\">Epoch &amp; Unix Timestamp Conversion Tools<\/a><\/li>\n<li><a href=\"https:\/\/currentmillis.com\/\" rel=\"nofollow noopener noreferrer\">currentDate \/ Time in Millisecondsmillis<\/a><\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"python\">Sys.time()  z &lt;- 1548802400 as.POSIXct(z, origin = &quot;1970-01-01&quot;)                # local as.POSIXct(z, origin = &quot;1970-01-01&quot;, tz = &quot;UTC&quot;)    # in UTC<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0412\u044b\u0432\u043e\u0434 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"plaintext\">## [1] &quot;2021-04-29 15:18:04 MSK&quot; ## [1] &quot;2019-01-30 01:53:20 MSK&quot; ## [1] &quot;2019-01-29 22:53:20 UTC&quot;<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<h2 id=\"rabota-s-dolyami-sekundy\">\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0434\u043e\u043b\u044f\u043c\u0438 \u0441\u0435\u043a\u0443\u043d\u0434\u044b<\/h2>\n<p>  <\/p>\n<p>\u041a\u043e\u0440\u043d\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u0430 \u0438\u0434\u0443\u0442 \u043e\u0442 \u0442\u0438\u043f\u043e\u0432\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0443 \u043b\u043e\u0433\u043e\u0432. \u0414\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u044b\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u0435\u043a\u0443\u043d\u0434\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0438 \u0442\u0443\u0442 \u043f\u043e\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432\u0430\u0440\u0438\u0430\u0446\u0438\u0438. \u0412\u0440\u0435\u043c\u044f \u0432 \u043b\u043e\u0433\u0435 \u043c\u043e\u0436\u0435\u0442 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u043f\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u044f\u043c ISO, \u0441 \u0434\u043e\u043b\u044f\u043c\u0438 \u0441\u0435\u043a\u0443\u043d\u0434 \u0432 \u0432\u0438\u0434\u0435 \u0434\u0440\u043e\u0431\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 (ISO 8601-2019);<\/li>\n<li>\u0441 \u043a\u0430\u043a\u0438\u043c\u0438-\u043d\u0438\u0431\u0443\u0434\u044c \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044f\u043c\u0438;<\/li>\n<li>\u043a\u0430\u043a \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u043b\u0435.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041e\u0431\u044a\u0435\u043a\u0442\u044b \u043a\u043b\u0430\u0441\u0441\u0430 <code>POSIXct<\/code> \u043c\u043e\u0433\u0443\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0438 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0441 \u0434\u0440\u043e\u0431\u043d\u044b\u043c\u0438 \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u043c\u0438, \u043d\u043e \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043f\u0440\u0438 \u0432\u044b\u0432\u043e\u0434\u0435 \u043d\u0430 \u043f\u0435\u0447\u0430\u0442\u044c \u0434\u0440\u043e\u0431\u043d\u044b\u0435 \u0447\u0430\u0441\u0442\u0438 \u043e\u043a\u0440\u0443\u0433\u043b\u044f\u044e\u0442\u0441\u044f \u0438\u0437-\u0437\u0430 \u0447\u0435\u0433\u043e \u043c\u043e\u0433\u0443\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u043d\u0430\u0434\u0443\u043c\u0430\u043d\u043d\u044b\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f. \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0438 \u0441\u043c\u043e\u0442\u0440\u0438\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">x &lt;- ymd_hms(&quot;2014-09-24 15:23:10&quot;) x x + 0.5 x + 0.5 + 0.6  options(digits.secs=5) x + 0.45756 options(digits.secs=0) x<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0412\u044b\u0432\u043e\u0434 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"plaintext\">## [1] &quot;2014-09-24 15:23:10 UTC&quot; ## [1] &quot;2014-09-24 15:23:10 UTC&quot; ## [1] &quot;2014-09-24 15:23:11 UTC&quot; ## [1] &quot;2014-09-24 15:23:10.45756 UTC&quot; ## [1] &quot;2014-09-24 15:23:10 UTC&quot;<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<p>\u0412\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a \u043b\u043e\u0433\u0430\u043c, \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">options(digits.secs=5)  # generate data df &lt;- data.frame(   timestamp = as_datetime(     round(runif(20, min = now() - seconds(10), max = now()), 0),      tz =&quot;Europe\/Moscow&quot;)) %&gt;%   mutate(ms = round(runif(n(), 0, 999), 0)) %&gt;%   mutate(value = round(runif(n(), 0, 100), 0))  dput(df)  # \u0441\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c &quot;\u0432 \u043b\u043e\u0431&quot; df %&gt;%   arrange(timestamp, ms) options(digits.secs=0)<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0412\u044b\u0432\u043e\u0434 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"plaintext\">## structure(list(timestamp = structure(c(1619698677, 1619698680,  ## 1619698676, 1619698682, 1619698675, 1619698682, 1619698679, 1619698679,  ## 1619698684, 1619698683, 1619698684, 1619698677, 1619698682, 1619698683,  ## 1619698675, 1619698676, 1619698685, 1619698681, 1619698683, 1619698681 ## ), class = c(&quot;POSIXct&quot;, &quot;POSIXt&quot;), tzone = &quot;Europe\/Moscow&quot;),  ##     ms = c(418, 689, 729, 108, 226, 843, 12, 370, 5, 581, 587,  ##     691, 102, 79, 640, 284, 241, 85, 329, 936), value = c(63,  ##     44, 63, 45, 29, 34, 80, 85, 42, 76, 94, 89, 34, 80, 1, 66,  ##     29, 81, 15, 98)), class = &quot;data.frame&quot;, row.names = c(NA,  ## -20L))<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/91\/9e\/_n\/919e_n3fyd8we97cqbmij0tbvpo.png\"><\/p>\n<p>  <\/p>\n<pre><code class=\"python\"># &quot;\u0443\u043c\u043d\u043e\u0435&quot; \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 # [magrittr aliases](https:\/\/magrittr.tidyverse.org\/reference\/aliases.html) df2 &lt;- df %&gt;%   mutate(timestamp = timestamp + ms\/1000) %&gt;%   # mutate_at(&quot;timestamp&quot;, ~`+`(. + ms\/1000)) %&gt;%   select(-ms)  df2 %&gt;% arrange(timestamp)<\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/od\/y0\/6s\/ody06sss_hx9_woxwzd5uquuc_w.png\"><\/p>\n<p>  <\/p>\n<pre><code class=\"python\"># \u0441\u0440\u0430\u0432\u043d\u0438\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u044b dt &lt;- as.data.table(df2) bench::mark(   naive = dplyr::arrange(df, timestamp, ms),   smart = dplyr::arrange(df2, timestamp),   dt = dt[order(timestamp)],   check = FALSE,   relative = TRUE,   min_iterations = 1000 )<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"plaintext\">## # A tibble: 3 x 6 ##   expression   min median `itr\/sec` mem_alloc `gc\/sec` ##   &lt;bch:expr&gt; &lt;dbl&gt;  &lt;dbl&gt;     &lt;dbl&gt;     &lt;dbl&gt;    &lt;dbl&gt; ## 1 naive       11.9   11.8      1         1.06     1    ## 2 smart       11.1   11.0      1.06      1        1.06 ## 3 dt           1      1       11.6     494.       1.22<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0430\u0440\u0441\u0438\u043d\u0433 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u0430\u043c\u0438.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">data &lt;- c(&quot;05102019210003657&quot;, &quot;05102019210003757&quot;, &quot;05102019210003857&quot;)  dmy_hms(stri_c(stri_sub(data, to = 14L), &quot;.&quot;, stri_sub(data, from = 15L)), tz = &quot;Europe\/Moscow&quot;)  # \u0418\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0435 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 data2 &lt;- data %&gt;%   sample(10^6, replace = TRUE) bench::mark(   stri_sub = stri_c(stri_sub(data2, to = 14L), &quot;.&quot;, stri_sub(data2, from = 15L)),   stri_replace = stri_replace_first_regex(data2, pattern = &quot;(^.{14})(.*)&quot;, replacement = &quot;$1.$2&quot;),   re2_replace = re2_replace(data2, pattern = &quot;(^.{14})(.*)&quot;, replacement = &quot;\\\\1.\\\\2&quot;, parallel = TRUE) )<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0412\u044b\u0432\u043e\u0434 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"plaintext\">## [1] &quot;2019-10-05 21:00:03 MSK&quot; &quot;2019-10-05 21:00:03 MSK&quot; ## [3] &quot;2019-10-05 21:00:03 MSK&quot; ## # A tibble: 3 x 6 ##   expression        min   median `itr\/sec` mem_alloc `gc\/sec` ##   &lt;bch:expr&gt;   &lt;bch:tm&gt; &lt;bch:tm&gt;     &lt;dbl&gt; &lt;bch:byt&gt;    &lt;dbl&gt; ## 1 stri_sub        214ms    222ms      4.10   22.89MB     5.47 ## 2 stri_replace    653ms    653ms      1.53    7.63MB     0    ## 3 re2_replace     409ms    413ms      2.42   15.29MB     1.21<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<h1 id=\"paket-lubridate\">\u041f\u0430\u043a\u0435\u0442 <code>lubridate<\/code><\/h1>\n<p>  <\/p>\n<pre><code class=\"python\">x &lt;- ymd(20101215) print(x) class(x)<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"plaintext\">## [1] &quot;2010-12-15&quot; ## [1] &quot;Date&quot;<\/code><\/pre>\n<p>  <\/p>\n<p>\u041c\u0430\u0433\u0438\u044f lubridate<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">ymd(20101215) == mdy(&quot;12\/15\/10&quot;)<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"plaintext\">## [1] TRUE<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">df &lt;- tibble(first = c(&quot;\u0418\u0432\u0430\u043d&quot;, &quot;\u041f\u0435\u0442\u0440&quot;, &quot;\u0410\u043b\u0435\u043a\u0441\u0435\u0439&quot;),              last = c(&quot;\u0418\u0432\u0430\u043d\u043e\u0432&quot;, &quot;\u041f\u0435\u0442\u0440\u043e\u0432&quot;, &quot;\u0421\u0438\u0434\u043e\u0440\u043e\u0432&quot;),              birthday_str = c(&quot;31-10-06&quot;, &quot;2\/4\/2007&quot;, &quot;1 June, 2005&quot;)) %&gt;%   mutate(birthday = dmy(birthday_str))  df<\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/uw\/sn\/h1\/uwsnh1wseqculfvnd6wobik_jh0.png\"><\/p>\n<p>  <\/p>\n<p>\u0410 \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u0432\u0440\u0435\u043c\u044f \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u0432 \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e \u043e\u0431\u0440\u0435\u0437\u0430\u043d\u043d\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435?<\/p>\n<p>  <\/p>\n<pre><code class=\"python\"># \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u043e\u0432 \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 \u0432 lubridate options(lubridate.verbose = TRUE) # \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u0434\u0430\u0442\u044b: \u0434.\u043c.\u0433 df &lt;- tibble(time_str = c(&quot;08.05.19 12:04:56&quot;, &quot;09.05.19 12:05&quot;, &quot;12.05.19 23&quot;))  lubridate::dmy_hms(df$time_str, tz = &quot;Europe\/Moscow&quot;) print(&quot;---------------------&quot;) lubridate::dmy(df$time_str, tz = &quot;Europe\/Moscow&quot;)<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"plaintext\">## [1] &quot;2019-05-08 12:04:56 MSK&quot; NA                        ## [3] NA                        ## [1] &quot;---------------------&quot; ## [1] NA NA NA<\/code><\/pre>\n<p>  <\/p>\n<p>\u0420\u0430\u0437\u0440\u0435\u0448\u0438\u043c \u0432\u0430\u0440\u0438\u0430\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0433\u043b\u0443\u0431\u0438\u043d\u044b<\/p>\n<p>  <\/p>\n<pre><code class=\"python\"># \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u043e\u0432 \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 \u0432 lubridate options(lubridate.verbose = TRUE)  lubridate::dmy_hms(df$time_str, truncated = 3, tz = &quot;Europe\/Moscow&quot;)<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"plaintext\">## [1] &quot;2019-05-08 12:04:56 MSK&quot; &quot;2019-05-09 12:05:00 MSK&quot; ## [3] &quot;2019-05-12 23:00:00 MSK&quot;<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\"># \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u043e\u0432 \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 \u0432 lubridate options(lubridate.verbose = TRUE) # \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u0434\u0430\u0442\u044b: \u0434.\u043c.\u0433 df &lt;- tibble(date_str = c(&quot;08.05.19&quot;, &quot;9\/5\/2019&quot;, &quot;2019-05-07&quot;))<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044e<\/p>\n<p>  <\/p>\n<pre><code class=\"python\"># \u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 glimpse(dmy(df$date_str)) print(&quot;---------------------&quot;) # \u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0432\u0442\u043e\u0440\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 glimpse(ymd(df$date_str)) print(&quot;---------------------&quot;)<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"plaintext\">##  Date[1:3], format: &quot;2019-05-08&quot; &quot;2019-05-09&quot; NA ## [1] &quot;---------------------&quot; ##  Date[1:3], format: &quot;2008-05-19&quot; NA &quot;2019-05-07&quot; ## [1] &quot;---------------------&quot;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0427\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c? \u0412\u0430\u0440\u0438\u0430\u043d\u0442, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0443\u0436\u0430\u0441\u0435\u043d, \u043d\u043e \u0447\u0442\u043e-\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0435\u043b\u0430\u0442\u044c.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">df %&gt;%   mutate(date = dplyr::coalesce(dmy(date_str), ymd(date_str)))<\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/go\/bp\/7d\/gobp7d0sz8dq69sm4oy5gpfh4ik.png\" alt=\"tab4\"><\/p>\n<p>  <\/p>\n<pre><code class=\"python\">df1 &lt;- df df1$date &lt;- dmy(df1$date_str) idx &lt;- is.na(df1$date) print(&quot;---------------------&quot;) idx df1$date[idx] &lt;- ymd(df1$date_str[idx])  print(&quot;---------------------&quot;) df1<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"plaintext\">## [1] &quot;---------------------&quot; ## [1] FALSE FALSE  TRUE ## [1] &quot;---------------------&quot;<\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/bz\/m0\/9b\/bzm09bhnbpznaer0nmbwspp5dza.png\" alt=\"tab5\"><\/p>\n<p>  <\/p>\n<h1 id=\"esche-pakety\">\u0415\u0449\u0435 \u043f\u0430\u043a\u0435\u0442\u044b<\/h1>\n<p>  <\/p>\n<p>\u0415\u0449\u0435 \u043f\u0430\u043a\u0435\u0442\u044b \u043d\u0430 &quot;\u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c&quot; \u0438 \u043f\u043e\u0438\u0437\u0443\u0447\u0430\u0442\u044c:<\/p>\n<p>  <\/p>\n<ul>\n<li><a href=\"http:\/\/dirk.eddelbuettel.com\/code\/anytime.html\" rel=\"nofollow noopener noreferrer\"><code>anytime<\/code><\/a><\/li>\n<li><a href=\"https:\/\/clock.r-lib.org\/\" rel=\"nofollow noopener noreferrer\"><code>clock<\/code><\/a><\/li>\n<\/ul>\n<p>  <\/p>\n<h1 id=\"arifmeticheskie-operacii-s-posixct\">\u0410\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441 POSIXct<\/h1>\n<p>  <\/p>\n<h2 id=\"raznost\">\u0420\u0430\u0437\u043d\u043e\u0441\u0442\u044c<\/h2>\n<p>  <\/p>\n<pre><code class=\"python\">options(lubridate.verbose = FALSE) date1 &lt;- ymd_hms(&quot;2011-09-23-03-45-23&quot;) date2 &lt;- ymd_hms(&quot;2011-10-03-21-02-19&quot;)  # \u043a\u0430\u043a\u043e\u0432\u0430 \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u043c\u0435\u0436\u0434\u0443 \u044d\u0442\u0438\u043c\u0438 \u0434\u0430\u0442\u0430\u043c\u0438? as.numeric(date2) - as.numeric(date1) # \u043a\u0430\u043a \u043c\u044b \u043f\u043e\u043c\u043d\u0438\u043c, \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445 (date2 - date1) %&gt;% dput()  difftime(date2, date1) difftime(date2, date1, unit=&quot;mins&quot;) difftime(date2, date1, unit=&quot;secs&quot;)<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"plaintext\">## [1] 926216 ## structure(10.7200925925926, class = &quot;difftime&quot;, units = &quot;days&quot;) ## Time difference of 10.72009 days ## Time difference of 15436.93 mins ## Time difference of 926216 secs<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"periody\">\u041f\u0435\u0440\u0438\u043e\u0434\u044b<\/h2>\n<p>  <\/p>\n<pre><code class=\"python\">date1 &lt;- ymd_hms(&quot;2019-01-30 00:00:00&quot;)  date1  date1 - days(1) date1 + days(1) date1 + days(2)<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"plaintext\">## [1] &quot;2019-01-30 UTC&quot; ## [1] &quot;2019-01-29 UTC&quot; ## [1] &quot;2019-01-31 UTC&quot; ## [1] &quot;2019-02-01 UTC&quot;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u2014 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043c\u0435\u0441\u044f\u0446\u044b<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">date1 - months(1) date1 + months(1) # \u0423\u041f\u0421!!!<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"plaintext\">## [1] &quot;2018-12-30 UTC&quot; ## [1] NA<\/code><\/pre>\n<p>  <\/p>\n<p>\u0415\u0441\u0442\u044c \u0432\u044b\u0445\u043e\u0434. \u041d\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043d\u0435 \u043a\u043e\u043c\u043c\u0443\u0442\u0430\u0442\u0438\u0432\u043d\u044b, \u044d\u0442\u043e \u043d\u0430\u0434\u043e \u043f\u043e\u043c\u043d\u0438\u0442\u044c.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">date1 %m-% months(1) date1 %m+% months(1) date1 %m+% months(1) %m-% months(1)<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"plaintext\">## [1] &quot;2018-12-30 UTC&quot; ## [1] &quot;2019-02-28 UTC&quot; ## [1] &quot;2019-01-28 UTC&quot;<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"nyuansy-vremennyh-zon\">\u041d\u044e\u0430\u043d\u0441\u044b \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0437\u043e\u043d<\/h2>\n<p>  <\/p>\n<pre><code class=\"python\">date1 &lt;- ymd_hms(&quot;2019-01-30 01:00:00&quot;)  date1 %T&gt;% print() %&gt;% dput()  with_tz(date1, tzone = &quot;Europe\/Moscow&quot;) %T&gt;% print() %&gt;% dput() force_tz(date1, tzone = &quot;Europe\/Moscow&quot;) %T&gt;% print() %&gt;% dput()<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0412\u044b\u0432\u043e\u0434 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"plaintext\">## [1] &quot;2019-01-30 01:00:00 UTC&quot; ## structure(1548810000, class = c(&quot;POSIXct&quot;, &quot;POSIXt&quot;), tzone = &quot;UTC&quot;) ## [1] &quot;2019-01-30 04:00:00 MSK&quot; ## structure(1548810000, class = c(&quot;POSIXct&quot;, &quot;POSIXt&quot;), tzone = &quot;Europe\/Moscow&quot;) ## [1] &quot;2019-01-30 01:00:00 MSK&quot; ## structure(1548799200, class = c(&quot;POSIXct&quot;, &quot;POSIXt&quot;), tzone = &quot;Europe\/Moscow&quot;)<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<h2 id=\"rabota-tolko-s-vremenymi-znacheniyami\">\u0420\u0430\u0431\u043e\u0442\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u0432\u0440\u0435\u043c\u0435\u043d\u042b\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438<\/h2>\n<p>  <\/p>\n<p>\u0427\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u0440\u0435\u043c\u044f, \u0430 \u0434\u0430\u0442\u044b \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u044b? \u041d\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u043d\u0430\u043c \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043f\u0430\u043a\u0435\u0442 <code>hms<\/code>. \u0422\u0430\u043a\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043a\u0430\u043a \u043f\u0435\u0440\u0438\u043e\u0434\u044b.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">hms_str &lt;- &quot;03:22:14&quot; as_hms(hms_str) dput(as_hms(hms_str)) print(&quot;-------&quot;)  x &lt;- as_hms(hms_str) * 15 x str(x) # seconds_to_period(period_to_seconds(x)) seconds_to_period(x) %T&gt;% dput() %&gt;% print()<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0412\u044b\u0432\u043e\u0434 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"plaintext\">## 03:22:14 ## structure(12134, units = &quot;secs&quot;, class = c(&quot;hms&quot;, &quot;difftime&quot;)) ## [1] &quot;-------&quot; ## Time difference of 182010 secs ##  'difftime' num 182010 ##  - attr(*, &quot;units&quot;)= chr &quot;secs&quot; ## new(&quot;Period&quot;, .Data = 30, year = 0, month = 0, day = 2, hour = 2,  ##     minute = 33) ## [1] &quot;2d 2H 33M 30S&quot;<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<h1 id=\"bd-i-vremennye-dannye\">\u0411\u0414 \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u042b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/h1>\n<p>  <\/p>\n<p>\u041e\u0434\u043d\u0430 \u0438\u0437 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0437\u0430\u0441\u0430\u0434 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u042b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0432 \u0411\u0414 \u2014 \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0441\u0442\u044c \u0438\u043b\u0438 \u043d\u0435\u043f\u043e\u043b\u043d\u0430\u044f \u043e\u0441\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u043e \u043c\u0435\u0445\u0430\u043d\u0438\u043a\u0435 \u0438 \u043b\u043e\u0433\u0438\u043a\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446. \u041d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043e\u043d\u0438 \u0441\u0442\u0440\u043e\u0438\u043b\u0438\u0441\u044c \u0438\u043b\u0438 \u0436\u0435 \u0442\u0435\u043a\u0441\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0439.<br \/>  \u0412 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0411\u0414 (\u0434\u0430\u043b\u0435\u0435 \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0442\u044c Clickhouse) \u0432\u0440\u0435\u043c\u044f, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u043a\u0430\u043a unixtimestamp \u0432 UTC. \u041d\u0443 \u0438\u043b\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b \u0438\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b, \u043d\u043e \u0432\u0441\u0435 \u043e\u043d\u0438 \u043a\u0440\u0443\u0442\u044f\u0442\u0441\u044f \u0432\u043e\u043a\u0440\u0443\u0433 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0435\u0434\u0438\u043d\u0438\u0446 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435\u043a\u043e\u0435\u0439 \u0440\u0435\u043f\u0435\u0440\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0438.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438 \u0437\u0430\u0441\u0430\u0434\u044b:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u041f\u0440\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u0443 \u0411\u0414 \u043a\u043e\u043b\u043e\u043d\u043a\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u043e\u0434 \u0435\u0435 \u043a\u0430\u043f\u043e\u0442\u043e\u043c \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u043c\u0430\u0441\u0441\u0430 \u043c\u0435\u0442\u0430\u043c\u043e\u0440\u0444\u043e\u0437. \u0411\u0414 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0443\u0435\u0442 timestamp, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043c\u043e\u0433\u0443\u0442 \u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0441\u0432\u043e\u0435 \u0432\u043b\u0438\u044f\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0437\u043e\u043d \u0438\u0437 \u0411\u0414, \u041e\u0421, \u043f\u043e\u043b\u044f, \u0441\u043c\u0435\u0436\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044f, \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f.<\/li>\n<li>\u041f\u0440\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0432\u043c\u0435\u0448\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u0440\u0430\u0439\u0432\u0435\u0440 (\u0441\u0435\u0440\u0438\u044f \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u0432 \u0438 \u0432\u0440\u0430\u043f\u043f\u0435\u0440\u043e\u0432). \u041f\u0440\u0438 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0437\u0430\u043c\u0435\u0448\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u0432, \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043b\u043e\u043a\u0430\u043b\u0438 \u041e\u0421, \u044f\u0437\u044b\u043a\u043e\u0432\u044b\u0435 \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0441\u0440\u0435\u0434\u044b, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0438 \u043e\u0442\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043b\u0443\u043d\u043d\u043e\u0433\u043e \u0441\u0432\u0435\u0442\u0430 \u0432 \u0431\u043e\u043b\u043e\u0442\u0435.<\/li>\n<li>\u0412 \u043f\u043e\u043b\u0435 unixtimestamp \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043c\u0435\u0449\u0430\u0442\u044c \u043e\u0442\u043d\u044e\u0434\u044c \u043d\u0435 UTC \u0432\u0440\u0435\u043c\u044f, \u0430 \u043c\u043e\u0441\u043a\u043e\u0432\u0441\u043a\u043e\u0435. \u0418\u043b\u0438 \u0438\u043d\u043e\u0435 (\u0441\u044e\u0440\u043f\u0440\u0438\u0437!).<\/li>\n<li>\u0412 \u0411\u0414 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u044f \u0438 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u043e \u0434\u0430\u0442\u0435, \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c\u043e\u0439 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u043e\u043b\u044f timestamp. \u0412 \u0441\u0438\u043b\u0443 \u0440\u0430\u0441\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0432 \u0442\u0440\u0430\u043a\u0442\u043e\u0432\u043a\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0437\u043e\u043d, \u0434\u0430\u043d\u043d\u044b\u0435 \u0437\u0430 \u0434\u0435\u043d\u044c <code>\u0425<\/code> \u0432\u043f\u043e\u043b\u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u0443\u0435\u0445\u0430\u0442\u044c \u0432 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0438 <code>X-1<\/code> \u0438\u043b\u0438 <code>X+1<\/code>, \u0447\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0438 \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043a \u0411\u0414.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0412 \u043e\u0431\u0449\u0435\u043c, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 \u043b\u044e\u0431\u043e\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0439 \u0441\u0440\u0435\u0434\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0431\u043b\u0438\u0437\u043e\u043a \u043a 0.<\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u044d\u0442\u043e\u0433\u043e \u0438 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0435\u0449\u0435 \u043c\u0430\u0441\u0441\u0443 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u0440\u0443\u0447\u043d\u043e\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435.<br \/>  \u0421\u0443\u0442\u044c \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0435 \u0434\u0430\u0442 \u0432 \u0447\u0438\u0441\u043b\u043e\u0432\u043e\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0431\u0430\u0437\u044b \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u043e \u0432\u0440\u0435\u043c\u044f (\u0442\u0430\u043c, \u0433\u0434\u0435 \u043d\u0430\u0434\u043e) \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430. \u0422\u0430\u043a\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0435 \u0441\u0438\u043b\u044c\u043d\u043e \u043e\u0431\u0440\u0435\u043c\u0435\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u0437\u0430\u0442\u043e \u0434\u0430\u0435\u0442 \u0434\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0443 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u043f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u042b\u0445 \u043c\u0435\u0442\u043e\u043a \u043d\u0430 \u0432\u0441\u0435\u0445 \u044d\u0442\u0430\u043f\u0430\u0445, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0432\u044b\u044f\u0432\u043b\u0435\u043d\u0438\u0438 \u043a\u043e\u0441\u044f\u043a\u043e\u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0438 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0411\u0414;<\/li>\n<li>\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u0432\u0435\u0440\u043a\u0438 \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c\u044b \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439 \u0441 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u043c\u0438;<\/li>\n<li>\u043f\u0440\u0435\u0446\u0438\u0437\u0438\u043e\u043d\u043d\u043e\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438 \u0437\u043e\u043d\u0430\u043c\u0438 \u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0439 \u0442\u0440\u0430\u043a\u0442\u043e\u0432\u043a\u0438;<\/li>\n<li>\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432 \u0434\u0430\u0442\u044b (\u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u0442\u0430\u0439\u043c\u0437\u043e\u043d);<\/li>\n<li>\u0441\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u0441\u0443\u0442\u043e\u0447\u043d\u044b\u0445 \u0430\u0433\u0440\u0435\u0433\u0430\u0442\u043e\u0432;<\/li>\n<li>\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0434\u0440\u043e\u0431\u043d\u044b\u0445 \u0434\u043e\u043b\u0435\u0439 \u0441\u0435\u043a\u0443\u043d\u0434 \u0432 \u0435\u0434\u0438\u043d\u044b\u0439 <code>double<\/code>;<\/li>\n<li>\u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u042b\u0445 \u0437\u0430\u0442\u0440\u0430\u0442 \u043d\u0430 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u043f\u043e \u0441\u0435\u0442\u0438;<\/li>\n<li>\u043e\u0431\u0449\u0435\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0422\u0440\u044e\u043a \u043f\u043e \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0431\u0435\u0437 \u043f\u043e\u0442\u0435\u0440\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438<\/p>\n<p>  <\/p>\n<pre><code class=\"sql\">-- \u0434\u0438\u0430\u043b\u0435\u043a\u0442 ClickHouse SELECT DISTINCT     store, pos,     timestamp, ms,     concat(toString(store), '-', toString(pos)) AS pos_uid,     toFloat64(timestamp) + (ms \/ 1000)          AS timestamp<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">flog.info(paste(&quot;SQL query:&quot;, sql_req)) tic(&quot;\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0438\u0437 CH&quot;) raw_df &lt;- dbGetQuery(conn, stri_encode(sql_req, to = &quot;UTF-8&quot;)) %&gt;%   mutate_if(is.character, `Encoding&lt;-`, &quot;UTF-8&quot;) %&gt;%   as_tibble() %&gt;%   mutate_at(vars(timestamp), anytime::anytime, tz = &quot;Europe\/Moscow&quot;) %&gt;%   mutate_at(&quot;event&quot;, as.factor) flog.info(capture.output(toc()))  DBI::dbDisconnect(conn)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0425\u0435\u043b\u043f\u0435\u0440 \u0434\u043b\u044f \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u043c\u043e\u0439 <code>data.frame<\/code> \u043f\u0430\u043c\u044f\u0442\u044c\u044e<\/p>\n<p>  <\/p>\n<pre><code class=\"python\"># \u0441\u0432\u043e\u0434\u043a\u0430 \u043f\u043e \u043e\u0431\u044a\u0435\u043c\u0430\u043c \u0434\u0430\u043d\u043d\u044b\u0445 df -&gt; as_tibble(_df) %&gt;%   map(pryr::object_size) %&gt;%    unlist() %&gt;%    enframe() %&gt;%    arrange(desc(value)) %&gt;%   mutate_at(&quot;value&quot;, fs::as_fs_bytes) %&gt;%   mutate(ratio = formattable::percent(value \/ sum(value), 2)) %&gt;%   add_row(name = &quot;TOTAL&quot;, value = sum(.$value))<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u043f\u043e \u0444\u043e\u0440\u043c\u0430\u0442\u0430\u043c \u0438 \u043a\u0430\u043b\u044c\u043a\u0443\u043b\u044f\u0442\u043e\u0440\u0430\u043c, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u043c \u043f\u0440\u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0435 \u043f\u0443\u0442\u0435\u0439 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u0442 \u0432 \u0418\u0421 \u0438 \u0411\u0414<\/p>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/www.epochconverter.com\/\" rel=\"nofollow noopener noreferrer\">Epoch &amp; Unix Timestamp Conversion Tools<\/a><\/li>\n<li><a href=\"https:\/\/currentmillis.com\/\" rel=\"nofollow noopener noreferrer\">currentdate\/time in millisecondsmillis<\/a><\/li>\n<li><a href=\"https:\/\/clickhouse.yandex\/docs\/en\/query_language\/functions\/date_time_functions\/\" rel=\"nofollow noopener noreferrer\">Functions for working with dates and times<\/a><\/li>\n<\/ul>\n<p>  <\/p>\n<h1 id=\"formatirovanie-dat\">\u0424\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u0442<\/h1>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438 \u0433\u0440\u0430\u0444\u0438\u043a\u043e\u0432, \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0435 \u0442\u0435\u043a\u0441\u0442\u043e\u0432, \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043a\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u043e\u0432, \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0442\u0435\u043a\u0441\u0442\u0430 \u0434\u0430\u0442\u044b \u0438 \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435 \u0447\u0430\u0441\u0442\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u044f \u0432\u044b\u0434\u0430\u0442\u044c \u0438\u043b\u0438 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0442\u044c \u0434\u0430\u0442\u0443 \u0432 \u0445\u0438\u0442\u0440\u043e\u043c \u0432\u0438\u0434\u0435. \u041d\u0438\u0436\u0435 \u0440\u044f\u0434 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432 \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0439.<\/p>\n<p>  <\/p>\n<h2 id=\"privyazka-k-rabochim-nedelyam\">\u041f\u0440\u0438\u0432\u044f\u0437\u043a\u0430 \u043a \u0440\u0430\u0431\u043e\u0447\u0438\u043c \u043d\u0435\u0434\u0435\u043b\u044f\u043c<\/h2>\n<p>  <\/p>\n<pre><code class=\"python\">df &lt;- seq.Date(from = as.Date(&quot;2021-01-01&quot;),                 to = as.Date(&quot;2021-05-31&quot;),                 by = &quot;2 days&quot;) %&gt;%   # sample(20, replace = FALSE) %&gt;%   tibble(date = .)<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\"># \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0442\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0433\u043e\u0434\/\u043c\u0435\u0441\u044f\u0446\/\u043d\u043e\u043c\u0435\u0440 \u043d\u0435\u0434\u0435\u043b\u0438 # \u0441\u043f\u043e\u0441\u043e\u0431 1 df %&gt;%   mutate(month_num = stri_c(lubridate::year(date),                              sprintf(&quot;%02d&quot;, lubridate::month(date)),                              sep = &quot;\/&quot;),          week_num = stri_c(lubridate::isoyear(date),                             sprintf(&quot;%02d&quot;, lubridate::isoweek(date)),                             sep = &quot;\/&quot;)   )<\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/6j\/xh\/b7\/6jxhb7het1k3h-vzik9b54tpoio.png\" alt=\"tab6\"><\/p>\n<p>  <\/p>\n<pre><code class=\"python\"># \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0442\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0433\u043e\u0434\/\u043c\u0435\u0441\u044f\u0446\/\u043d\u043e\u043c\u0435\u0440 \u043d\u0435\u0434\u0435\u043b\u0438 # \u0441\u043f\u043e\u0441\u043e\u0431 2, \u0437\u0430\u043e\u0434\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0434\u0435\u043d\u044c \u043d\u0435\u0434\u0435\u043b\u0438  # \u043e\u0441\u043e\u0431\u043e\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u043c, \u0447\u0442\u043e \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0435 \u043f\u043e\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u044f\u0442\u0441\u044f \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u043b\u043e\u043a\u0430\u043b\u0438!!! df %&gt;%   mutate(month_num = format(date, &quot;%Y\/%m (%a) ISO week %V&quot;))<\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/mq\/9m\/oa\/mq9moawyexaouuwn69tfe9eovwc.png\" alt=\"tab7\"><\/p>\n<p>  <\/p>\n<pre><code class=\"python\"># \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0442\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0433\u043e\u0434\/\u043c\u0435\u0441\u044f\u0446\/\u043d\u043e\u043c\u0435\u0440 \u043d\u0435\u0434\u0435\u043b\u0438 # \u0441\u043f\u043e\u0441\u043e\u0431 3, \u0437\u0430\u043e\u0434\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0434\u0435\u043d\u044c \u043d\u0435\u0434\u0435\u043b\u0438 # \u0445\u0435\u043b\u043f\u0435\u0440 \u043f\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044e \u0444\u043e\u0440\u043c\u0430\u0442\u0430 strptime (ISO 8601) \u0432 ICU # https:\/\/man7.org\/linux\/man-pages\/man3\/strptime.3.html stri_datetime_fstr(&quot;%Y\/%m (%a) week %V&quot;) # ggthemes::tableau_color_pal(&quot;Tableau 20&quot;)(20) %&gt;% scales::show_col()  # \u043e\u0441\u043e\u0431\u043e\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u043c, \u0447\u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c\u044e \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e!!! df %&gt;%   mutate(     month_num_ru = stri_datetime_format(       date, &quot;yyyy'\/'MM' ('ccc') week 'ww&quot;, locale = &quot;ru&quot;, tz = &quot;UTC&quot;),     month_num_en = stri_datetime_format(       date, &quot;yyyy'\/'MM' ('ccc') week 'ww&quot;, locale = &quot;en&quot;, tz = &quot;UTC&quot;))<\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/qo\/k-\/ue\/qok-uegekth1fvwnhlmevj2ljcm.png\" alt=\"tab8\"><\/p>\n<p>  <\/p>\n<h2 id=\"dni-nedeli\">\u0414\u043d\u0438 \u043d\u0435\u0434\u0435\u043b\u0438<\/h2>\n<p>  <\/p>\n<p>\u041f\u0438\u0448\u0435\u043c \u0434\u043d\u0438 \u043d\u0435\u0434\u0435\u043b\u0438 \u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043b\u043e\u043a\u0430\u043b\u044f\u0445. \u041d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">stri_datetime_format(today(), &quot;LLLL&quot;, locale=&quot;ru@calendar=Persian&quot;) stri_datetime_format(today(), &quot;LLLL&quot;, locale=&quot;ru@calendar=Indian&quot;) stri_datetime_format(today(), &quot;LLLL&quot;, locale=&quot;ru@calendar=Hebrew&quot;) stri_datetime_format(today(), &quot;LLLL&quot;, locale=&quot;ru@calendar=Islamic&quot;) stri_datetime_format(today(), &quot;LLLL&quot;, locale=&quot;ru@calendar=Coptic&quot;) stri_datetime_format(today(), &quot;LLLL&quot;, locale=&quot;ru@calendar=Ethiopic&quot;) stri_datetime_format(today(), &quot;dd MMMM yyyy&quot;, locale=&quot;ru&quot;) stri_datetime_format(today(), &quot;LLLL d, yyyy&quot;, locale=&quot;ru&quot;)<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"plaintext\">## [1] &quot;\u043e\u0440\u0434\u0438\u0431\u0435\u0445\u0435\u0448\u0442&quot; ## [1] &quot;\u0432\u0430\u0438\u0441\u0430\u043a\u0445\u0430&quot; ## [1] &quot;\u0438\u044f\u0440&quot; ## [1] &quot;\u0440\u0430\u043c\u0430\u0434\u0430\u043d&quot; ## [1] &quot;\u0431\u0430\u0440\u043c\u0443\u0434\u0430&quot; ## [1] &quot;\u043c\u0438\u0430\u0437\u0438\u044f&quot; ## [1] &quot;29 \u0430\u043f\u0440\u0435\u043b\u044f 2021&quot; ## [1] &quot;\u0430\u043f\u0440\u0435\u043b\u044c 29, 2021&quot;<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"sobstvennoe-formatirovanie-dat-po-osyam-grafikov\">\u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u0442 \u043f\u043e \u043e\u0441\u044f\u043c \u0433\u0440\u0430\u0444\u0438\u043a\u043e\u0432<\/h2>\n<p>  <\/p>\n<p>\u0418\u043d\u043e\u0433\u0434\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u043a \u043e\u0441\u0435\u0439. \u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0442\u0430\u043a\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/p>\n<p>  <\/p>\n<pre><code class=\"python\"># \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 map_tbl &lt;- tibble(   date = as_date(Sys.time() + rnorm(10^3, mean = 0, sd = 60 * 60 * 24 * 7))) %&gt;%   mutate(store = stri_c(sample(c(&quot;A&quot;, &quot;F&quot;, &quot;Y&quot;, &quot;Z&quot;), n(), replace = TRUE),                         sample(101:105, n(), replace = TRUE))) %&gt;%   mutate(store_fct = as.factor(store)) %&gt;%   mutate(fail_ratio = abs(rnorm(n(), mean = 0.3, sd = 1)))<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"python\">my_date_format &lt;- function (format = &quot;dd MMMM yyyy&quot;, tz = &quot;Europe\/Moscow&quot;)  {   scales:::force_all(format, tz)   # stri_datetime_fstr(&quot;%d.%m%n%A&quot;)   # stri_datetime_fstr(&quot;%d.%m (%a)&quot;)   function(x) stri_datetime_format(x, format, locale = &quot;ru&quot;, tz = tz) }  # \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u0433\u0440\u0430\u0444\u0438\u043a, \u043d\u043e \u0432 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u043a\u0435 \u043f\u043e \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u0438 gp &lt;- map_tbl %&gt;%   ggplot(aes(x = date, y = store_fct, fill = fail_ratio)) +   geom_tile(color = &quot;white&quot;, size = 0.1) +   # scale_fill_distiller(palette = &quot;RdYlGn&quot;, name = &quot;Fail Ratio&quot;, label = comma) +   # scale_fill_distiller(palette = &quot;RdYlGn&quot;, name = &quot;Fail Ratio&quot;, guide = guide_legend(keywidth = unit(4, &quot;cm&quot;))) +   scale_fill_distiller(palette = &quot;RdYlGn&quot;, name = &quot;Fail Ratio&quot;) +   scale_x_date(breaks = scales::date_breaks(&quot;1 week&quot;), labels = my_date_format(&quot;dd'.'MM' ('ccc')'&quot;)) +   coord_equal() +   labs(x = NULL, y = NULL, title = &quot;\u0421\u0440\u0435\u0434\u043d\u0438\u0439 % \u0441\u0431\u043e\u0435\u0432 \u043f\u043e \u0434\u043d\u044f\u043c&quot;) +   theme_minimal() +   theme(plot.title = element_text(hjust = 0)) +   theme(axis.ticks = element_blank()) +   theme(axis.text = element_text(size = 7)) +   theme(axis.text.x = element_text(angle = 90, vjust = 0.5)) +   theme(legend.position = &quot;bottom&quot;) +   theme(legend.key.width = unit(3, &quot;cm&quot;))  gp<\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/rn\/pa\/i6\/rnpai6lfndytyugbufguith_1ou.png\" alt=\"heatmap\"><\/p>\n<p>  <\/p>\n<h1 id=\"testy-proizvoditelnosti\">\u0422\u0435\u0441\u0442\u044b \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438<\/h1>\n<p>  <\/p>\n<h2 id=\"prostaya-matematika\">\u041f\u0440\u043e\u0441\u0442\u0430\u044f \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0430<\/h2>\n<p>  <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0437\u0430\u043f\u0438\u0441\u0435\u0439<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">base_df &lt;- tibble(   start = Sys.time() + rnorm(10^3, mean = 0, sd = 60 * 24 * 3)) %&gt;%   mutate(finish = start + rnorm(n(), mean = 100, sd = 60)) %&gt;%   mutate(user_id = sample(as.character(1000:1100), n(), replace = TRUE)) %&gt;%   arrange(user_id, start)  dt &lt;- as.data.table(base_df, key = c(&quot;user_id&quot;, &quot;start&quot;)) %&gt;%   .[, c(&quot;start&quot;, &quot;finish&quot;) := lapply(.SD, as.numeric),      .SDcols = c(&quot;start&quot;, &quot;finish&quot;)]<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0421\u0430\u043c \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">df &lt;- group_by(base_df, user_id)  bench::mark(   dplyr_v1 = df %&gt;% transmute(delta_t = as.numeric(difftime(finish, start, units = &quot;secs&quot;))) %&gt;% ungroup(),   dplyr_v2 = ungroup(df) %&gt;% transmute(delta_t = as.numeric(difftime(finish, start, units = &quot;secs&quot;))),   dplyr_v3 = dt %&gt;% transmute(delta_t = finish - start),   dt_v1 = dt[, .(delta_t = finish - start), by = user_id],   dt_v2 = dt[, .(delta_t = finish - start)],   check = FALSE # all_equal \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e )<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<pre><code class=\"plaintext\">## # A tibble: 5 x 6 ##   expression      min   median `itr\/sec` mem_alloc `gc\/sec` ##   &lt;bch:expr&gt; &lt;bch:tm&gt; &lt;bch:tm&gt;     &lt;dbl&gt; &lt;bch:byt&gt;    &lt;dbl&gt; ## 1 dplyr_v1      4.3ms   4.86ms      200.   103.1KB    11.4  ## 2 dplyr_v2     2.17ms   2.46ms      380.    17.9KB     6.24 ## 3 dplyr_v3     1.67ms   1.77ms      527.    29.8KB     8.51 ## 4 dt_v1       410.4us  438.7us     2139.    90.8KB     8.35 ## 5 dt_v2       304.4us  335.3us     2785.   264.6KB     8.38<\/code><\/pre>\n<p>  <\/p>\n<p>\u0423 \u043c\u0435\u043d\u044f \u0434\u0430\u043d\u043d\u044b\u0435 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u0433\u043e\u0434\/\u043c\u0435\u0441\u044f\u0446\/\u0447\u0438\u0441\u043b\u043e. \u041c\u043d\u0435 \u043d\u0435 \u0432\u0441\u0435 \u043d\u0443\u0436\u043d\u044b, \u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0443\u0431\u0431\u043e\u0442\u0430, \u043a\u0430\u043a \u043c\u043d\u0435 \u043e\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u0442\u044c?<\/p>\n<p>  <\/p>\n<pre><code class=\"python\"># https:\/\/stackoverflow.com\/questions\/16347731\/how-to-change-the-locale-of-r # https:\/\/jangorecki.gitlab.io\/data.cube\/library\/stringi\/html\/stringi-locale.html  df &lt;- as.Date(&quot;2020-01-01&quot;) %&gt;%    seq.Date(to = . + months(4), by = &quot;1 day&quot;) %&gt;%   tibble(date = .) %&gt;%   mutate(wday = lubridate::wday(date, week_start = 1),          wday_abb_rus = lubridate::wday(date, label = TRUE, week_start = 1),          wday_abb_enu = lubridate::wday(date, label = TRUE, week_start = 1, locale = &quot;English&quot;),          wday_stri = stringi::stri_datetime_format(date, &quot;EEEE&quot;, locale = &quot;en&quot;))  # \u043e\u0441\u0442\u0430\u0432\u0438\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0443\u0431\u0431\u043e\u0442\u044b filter(df, wday == 6)<\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/6y\/xv\/me\/6yxvmew_bc03lc0tmuiypyvjnda.png\" alt=\"tab9\"><\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0430\u044f \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044f \u2014 <a href=\"https:\/\/habr.com\/ru\/post\/550962\/\">\u00abR vs Python \u0432 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0438\u0432\u043d\u043e\u043c \u043a\u043e\u043d\u0442\u0443\u0440\u0435\u00bb<\/a>.<\/p>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/555126\/\"> https:\/\/habr.com\/ru\/post\/555126\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\n<p>\u0414\u0430\u0442\u044b \u0438 \u0432\u0440\u0435\u043c\u044f \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432\u0435\u0441\u044c\u043c\u0430 \u043d\u0435\u043f\u0440\u043e\u0441\u0442\u044b\u043c\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u043c\u0435\u0441\u044f\u0446\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0434\u043d\u0435\u0439;<\/li>\n<li>\u0433\u043e\u0434\u0430 \u0431\u044b\u0432\u0430\u044e\u0442 \u0432\u0438\u0441\u043e\u043a\u043e\u0441\u043d\u044b\u043c\u0438 \u0438 \u043d\u0435\u0442;<\/li>\n<li>\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u042b\u0435 \u0437\u043e\u043d\u044b;<\/li>\n<li>\u0447\u0430\u0441\u044b, \u043c\u0438\u043d\u0443\u0442\u044b, \u0434\u043d\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0441\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u0440\u044f\u0434 \u043c\u043e\u043c\u0435\u043d\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0435\u0434\u043a\u043e \u0432\u044b\u0441\u0432\u0435\u0447\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0442\u0440\u044e\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043f\u0438\u0441\u0430\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u0435\u043c\u044b\u0439 \u043a\u043e\u0434.<\/p>\n<p>  <\/p>\n<p>\u0421\u043e\u0432\u0441\u0435\u043c \u043a\u0440\u0430\u0442\u043a\u043e\u0435 \u0440\u0435\u0437\u044e\u043c\u0435 \u0434\u043b\u044f \u0441\u043c\u0430\u0440\u0442\u0444\u043e\u043d\u043e\u0447\u0438\u0442\u0430\u043b\u0435\u0439: \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043c\u0430\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e <code>POSIXct<\/code> \u0441 \u0434\u0440\u043e\u0431\u043d\u044b\u043c\u0438 \u0434\u043e\u043b\u044f\u043c\u0438 \u0441\u0435\u043a\u0443\u043d\u0434. \u0411\u0443\u0434\u0435\u0442 \u0445\u043e\u0440\u043e\u0448\u043e, \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0431\u044b\u0441\u0442\u0440\u043e.<\/p>\n<p>  <\/p>\n<p>\u042f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435\u043c <a href=\"https:\/\/habrahabr.ru\/users\/i_shutov\/posts\/\" rel=\"nofollow noopener noreferrer\">\u0441\u0435\u0440\u0438\u0438 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0439<\/a>.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-322311","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/322311","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=322311"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/322311\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=322311"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=322311"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=322311"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}