summaryrefslogtreecommitdiffstats
path: root/docs/nspr/reference/pr_normalizetime.rst
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /docs/nspr/reference/pr_normalizetime.rst
parentInitial commit. (diff)
downloadthunderbird-upstream.tar.xz
thunderbird-upstream.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'docs/nspr/reference/pr_normalizetime.rst')
-rw-r--r--docs/nspr/reference/pr_normalizetime.rst62
1 files changed, 62 insertions, 0 deletions
diff --git a/docs/nspr/reference/pr_normalizetime.rst b/docs/nspr/reference/pr_normalizetime.rst
new file mode 100644
index 0000000000..47a82ae78b
--- /dev/null
+++ b/docs/nspr/reference/pr_normalizetime.rst
@@ -0,0 +1,62 @@
+PR_NormalizeTime
+================
+
+Adjusts the fields of a clock/calendar time to their proper ranges,
+using a callback function.
+
+
+Syntax
+------
+
+.. code::
+
+ #include <prtime.h>
+
+ void PR_NormalizeTime (
+ PRExplodedTime *time,
+ PRTimeParamFn params);
+
+
+Parameters
+~~~~~~~~~~
+
+The function has these parameters:
+
+``time``
+ A pointer to a clock/calendar time in the :ref:`PRExplodedTime` format.
+``params``
+ A time parameter callback function.
+
+
+Returns
+~~~~~~~
+
+Nothing; the ``time`` parameter is altered by the callback function.
+
+
+Description
+-----------
+
+This function adjusts the fields of the specified time structure using
+the specified time parameter callback function, so that they are in the
+proper range.
+
+Call this function in these situations:
+
+- To normalize a time after performing arithmetic operations directly
+ on the field values of the calendar time object. For example, if you
+ have a ``]`` object that represents the date 3 March 1998 and you
+ want to say "forty days from 3 March 1998", you can simply add 40 to
+ the ``tm_mday`` field and then call ``PR_NormalizeTime()``.
+
+- To calculate the optional field values ``tm_wday`` and ``tm_yday``.
+ For example, suppose you want to compute the day of week for 3 March
+ 1998. You can set ``tm_mday`` to 3, ``tm_month`` to 2, and
+ ``tm_year`` to 1998, and all the other fields to 0, then call
+ ``PR_NormalizeTime()`` with :ref:`PR_GMTParameters`. On return,
+ ``tm_wday`` (and ``tm_yday``) are set for you.
+
+- To convert from one time zone to another. For example, if the input
+ argument time is in time zone A and the input argument ``params``
+ represents time zone B, when ``PR_NormalizeTime()`` returns, time
+ will be in time zone B.