You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

112 lines
3.3 KiB

  1. From 809d416ac092a42aaf1752dc789d5a828c45d42b Mon Sep 17 00:00:00 2001
  2. From: Thierry FOURNIER <thierry.fournier@ozon.io>
  3. Date: Wed, 14 Dec 2016 19:04:41 +0100
  4. Subject: [PATCH 05/19] DOC: lua: documentation about time parser functions
  5. This patch must be backported in version 1.7
  6. (cherry picked from commit a78f037505c3176aef3ce80f6aaac2fdcc92ca27)
  7. ---
  8. doc/lua-api/index.rst | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++
  9. 1 file changed, 87 insertions(+)
  10. diff --git a/doc/lua-api/index.rst b/doc/lua-api/index.rst
  11. index 22c0538..3cb2b4b 100644
  12. --- a/doc/lua-api/index.rst
  13. +++ b/doc/lua-api/index.rst
  14. @@ -297,6 +297,93 @@ Core class
  15. contains the current at the epoch format, and "usec" contains the
  16. current microseconds.
  17. +.. js:function:: core.http_date(date)
  18. +
  19. + **context**: body, init, task, action
  20. +
  21. + This function take a string repsenting http date, and returns an integer
  22. + containing the corresponding date with a epoch format. A valid http date
  23. + me respect the format IMF, RFC850 or ASCTIME.
  24. +
  25. + :param string date: a date http-date formatted
  26. + :returns: integer containing epoch date
  27. + :see: :js:func:`core.imf_date`.
  28. + :see: :js:func:`core.rfc850_date`.
  29. + :see: :js:func:`core.asctime_date`.
  30. + :see: https://tools.ietf.org/html/rfc7231#section-7.1.1.1
  31. +
  32. +.. js:function:: core.imf_date(date)
  33. +
  34. + **context**: body, init, task, action
  35. +
  36. + This function take a string repsenting IMF date, and returns an integer
  37. + containing the corresponding date with a epoch format.
  38. +
  39. + :param string date: a date IMF formatted
  40. + :returns: integer containing epoch date
  41. + :see: https://tools.ietf.org/html/rfc7231#section-7.1.1.1
  42. +
  43. + The IMF format is like this:
  44. +
  45. +.. code-block:: text
  46. +
  47. + Sun, 06 Nov 1994 08:49:37 GMT
  48. +..
  49. +
  50. +.. js:function:: core.rfc850_date(date)
  51. +
  52. + **context**: body, init, task, action
  53. +
  54. + This function take a string repsenting RFC850 date, and returns an integer
  55. + containing the corresponding date with a epoch format.
  56. +
  57. + :param string date: a date RFC859 formatted
  58. + :returns: integer containing epoch date
  59. + :see: https://tools.ietf.org/html/rfc7231#section-7.1.1.1
  60. +
  61. + The RFC850 format is like this:
  62. +
  63. +.. code-block:: text
  64. +
  65. + Sunday, 06-Nov-94 08:49:37 GMT
  66. +..
  67. +
  68. +.. js:function:: core.asctime_date(date)
  69. +
  70. + **context**: body, init, task, action
  71. +
  72. + This function take a string repsenting ASCTIME date, and returns an integer
  73. + containing the corresponding date with a epoch format.
  74. +
  75. + :param string date: a date ASCTIME formatted
  76. + :returns: integer containing epoch date
  77. + :see: https://tools.ietf.org/html/rfc7231#section-7.1.1.1
  78. +
  79. + The ASCTIME format is like this:
  80. +
  81. +.. code-block:: text
  82. +
  83. + Sun Nov 6 08:49:37 1994
  84. +..
  85. +
  86. +.. js:function:: core.rfc850_date(date)
  87. +
  88. + **context**: body, init, task, action
  89. +
  90. + This function take a string repsenting http date, and returns an integer
  91. + containing the corresponding date with a epoch format.
  92. +
  93. + :param string date: a date http-date formatted
  94. +
  95. +.. js:function:: core.asctime_date(date)
  96. +
  97. + **context**: body, init, task, action
  98. +
  99. + This function take a string repsenting http date, and returns an integer
  100. + containing the corresponding date with a epoch format.
  101. +
  102. + :param string date: a date http-date formatted
  103. +
  104. .. js:function:: core.msleep(milliseconds)
  105. **context**: body, init, task, action
  106. --
  107. 2.10.2