Browse Source

HPCC-16356 Add some Time functions to Std Library Reference

Signed-off-by: Jim DeFabia <jamesdefabia@lexisnexis.com>
Jim DeFabia 8 years ago
parent
commit
22c0a19d31

+ 3 - 0
docs/ECLStandardLibraryReference/SLR-Mods/DateDataTypes.xml

@@ -74,4 +74,7 @@ EXPORT Date_t := UNSIGNED4;
     //A number of elapsed days.  Value depends on the function called.
 EXPORT Days_t := UNSIGNED4;
 </programlisting>
+
+  <para>See Also: <link linkend="Date_Data_Types">Time Data
+  Types</link></para>
 </sect1>

+ 50 - 0
docs/ECLStandardLibraryReference/SLR-Mods/Hour.xml

@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+<sect1 id="Hour">
+  <title>Hour</title>
+
+  <para><emphasis role="bold">STD.Date.Hour<indexterm>
+      <primary>STD.Date.Hour</primary>
+    </indexterm><indexterm>
+      <primary>Date.Hour</primary>
+    </indexterm>(</emphasis> <emphasis>time</emphasis> <emphasis
+  role="bold">)</emphasis></para>
+
+  <informaltable colsep="1" frame="all" rowsep="1">
+    <tgroup cols="2">
+      <colspec colwidth="80.50pt" />
+
+      <colspec />
+
+      <tbody>
+        <row>
+          <entry><emphasis>time</emphasis></entry>
+
+          <entry>A time value in the Time_ format.</entry>
+        </row>
+
+        <row>
+          <entry>Return:</entry>
+
+          <entry>Hour returns an INTEGER value representing the hour in the
+          range of 0-23.</entry>
+        </row>
+      </tbody>
+    </tgroup>
+  </informaltable>
+
+  <para>The <emphasis role="bold">Hour</emphasis> function returns the hour
+  from the <emphasis>time</emphasis> value.</para>
+
+  <para>Example:</para>
+
+  <programlisting format="linespecific">IMPORT STD;
+MyTime:= STD.Date.CurrentTime(TRUE);   //Local Time
+  
+t1 := STD.Date.Hour(MyTime);
+    //t1 contains the hour of the current local time
+</programlisting>
+
+  <para></para>
+</sect1>

+ 50 - 0
docs/ECLStandardLibraryReference/SLR-Mods/Minute.xml

@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+<sect1 id="Minute">
+  <title>Minute</title>
+
+  <para><emphasis role="bold">STD.Date.Minute<indexterm>
+      <primary>STD.Date.Minute</primary>
+    </indexterm><indexterm>
+      <primary>Date.Minute</primary>
+    </indexterm>(</emphasis> <emphasis>time</emphasis> <emphasis
+  role="bold">)</emphasis></para>
+
+  <informaltable colsep="1" frame="all" rowsep="1">
+    <tgroup cols="2">
+      <colspec colwidth="80.50pt" />
+
+      <colspec />
+
+      <tbody>
+        <row>
+          <entry><emphasis>time</emphasis></entry>
+
+          <entry>A time value in the Time_ format.</entry>
+        </row>
+
+        <row>
+          <entry>Return:</entry>
+
+          <entry>Minute returns an INTEGER value representing the minute in
+          the range of 0-59.</entry>
+        </row>
+      </tbody>
+    </tgroup>
+  </informaltable>
+
+  <para>The <emphasis role="bold">Minute</emphasis> function returns the
+  minute from the <emphasis>time</emphasis> value.</para>
+
+  <para>Example:</para>
+
+  <programlisting format="linespecific">IMPORT STD;
+MyTime:= STD.Date.CurrentTime(TRUE);   //Local Time
+  
+t1 := STD.Date.Minute(MyTime);
+    //t1 contains the minute of the current local time
+</programlisting>
+
+  <para></para>
+</sect1>

+ 50 - 0
docs/ECLStandardLibraryReference/SLR-Mods/Second.xml

@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+<sect1 id="Second">
+  <title>Second</title>
+
+  <para><emphasis role="bold">STD.Date.Second<indexterm>
+      <primary>STD.Date.Second</primary>
+    </indexterm><indexterm>
+      <primary>Date.Second</primary>
+    </indexterm>(</emphasis> <emphasis>time</emphasis> <emphasis
+  role="bold">)</emphasis></para>
+
+  <informaltable colsep="1" frame="all" rowsep="1">
+    <tgroup cols="2">
+      <colspec colwidth="80.50pt" />
+
+      <colspec />
+
+      <tbody>
+        <row>
+          <entry><emphasis>time</emphasis></entry>
+
+          <entry>A time value in the Time_ format.</entry>
+        </row>
+
+        <row>
+          <entry>Return:</entry>
+
+          <entry>Second returns an INTEGER value representing the second in
+          the range of 0-59.</entry>
+        </row>
+      </tbody>
+    </tgroup>
+  </informaltable>
+
+  <para>The <emphasis role="bold">Second</emphasis> function returns the
+  second from the <emphasis>time</emphasis> value.</para>
+
+  <para>Example:</para>
+
+  <programlisting format="linespecific">IMPORT STD;
+MyTime:= STD.Date.CurrentTime(TRUE);   //Local Time
+  
+t1 := STD.Date.Second(MyTime);
+    //t1 contains the second of the current local time
+</programlisting>
+
+  <para></para>
+</sect1>

+ 107 - 0
docs/ECLStandardLibraryReference/SLR-Mods/TimeDataTypes.xml

@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+<sect1 id="Time_Data_Types">
+  <title>Time Data Types</title>
+
+  <para><emphasis role="bold">STD.Date.Time_rec<indexterm>
+      <primary>STD.Date.Time_rec</primary>
+    </indexterm><indexterm>
+      <primary>Date.Time_rec</primary>
+    </indexterm></emphasis></para>
+
+  <para><emphasis role="bold">STD.Date.Time_t<indexterm>
+      <primary>STD.Date.Time_t</primary>
+    </indexterm><indexterm>
+      <primary>Date.Time_t</primary>
+    </indexterm></emphasis></para>
+
+  <para><emphasis role="bold">STD.DateTime_rec <indexterm>
+      <primary><emphasis role="bold">STD.DateTime_rec</emphasis></primary>
+    </indexterm><indexterm>
+      <primary><emphasis role="bold">DateTime_rec</emphasis></primary>
+    </indexterm></emphasis></para>
+
+  <para><emphasis role="bold">STD.Timestamp_t <indexterm>
+      <primary><emphasis role="bold">STD.Timestamp_t</emphasis></primary>
+    </indexterm><indexterm>
+      <primary><emphasis role="bold">Timestamp_t</emphasis></primary>
+    </indexterm></emphasis></para>
+
+  <informaltable colsep="1" frame="all" rowsep="1">
+    <tgroup cols="2">
+      <colspec colwidth="80.50pt" />
+
+      <colspec />
+
+      <tbody>
+        <row>
+          <entry><emphasis role="bold">Time_rec</emphasis></entry>
+
+          <entry>A RECORD structure containing three fields, and INTEGER1
+          hour, an UNSIGNED1 minute, and an UNSIGNED1 second.</entry>
+        </row>
+
+        <row>
+          <entry><emphasis role="bold">Time_t</emphasis></entry>
+
+          <entry>An UNSIGNED3 holding a time of day in the decimal form
+          HHMMDD.</entry>
+        </row>
+
+        <row>
+          <entry><emphasis role="bold">Seconds_t</emphasis></entry>
+
+          <entry>An INTEGER8 holding holding a number of seconds. Can be used
+          to represent either a duration or the number of seconds since epoch
+          (Jan 1, 1970). </entry>
+        </row>
+
+        <row>
+          <entry><emphasis role="bold">DateTime_rec</emphasis></entry>
+
+          <entry>A RECORD structure containing both a Date_rec and a
+          Time_rec</entry>
+        </row>
+
+        <row>
+          <entry><emphasis role="bold">Timestamp_t </emphasis></entry>
+
+          <entry>An INTEGER8 holding a number of microseconds. Can be used to
+          represent // either a duration or the number of microseconds since
+          epoch (Jan 1, 1970).</entry>
+        </row>
+      </tbody>
+    </tgroup>
+  </informaltable>
+
+  <para>The Time data types defined in the Date Standard Library are:</para>
+
+  <programlisting format="linespecific">// A record structure with the different time elements separated out.
+EXPORT Time_rec := RECORD
+    UNSIGNED1   hour;
+    UNSIGNED1   minute;
+    UNSIGNED1   second;
+END;
+
+// An unsigned number holding a time of day in the decimal form HHMMDD.
+EXPORT Time_t := UNSIGNED3;
+// A signed number holding a number of seconds.  Can be used to represent either
+// a duration or the number of seconds since epoch (Jan 1, 1970).
+EXPORT Seconds_t := INTEGER8;
+
+
+// A record structure with the different date and time elements separated out.
+EXPORT DateTime_rec := RECORD
+    Date_rec;
+    Time_Rec;
+END;
+
+// A signed number holding a number of microseconds.  Can be used to represent
+// either a duration or the number of microseconds since epoch (Jan 1, 1970).
+EXPORT Timestamp_t := INTEGER8;
+</programlisting>
+
+  <para>See Also: <link linkend="Date_Data_Types">Date Data
+  Types</link></para>
+</sect1>

+ 25 - 14
docs/ECLStandardLibraryReference/SLR-includer.xml

@@ -170,10 +170,9 @@
 
     <xi:include href="ECLStandardLibraryReference/SLR-Mods/CreateExternalDirectory.xml"
                 xmlns:xi="http://www.w3.org/2001/XInclude" />
-                
+
     <xi:include href="ECLStandardLibraryReference/SLR-Mods/RemoteDirectory.xml"
                 xmlns:xi="http://www.w3.org/2001/XInclude" />
-              
   </chapter>
 
   <chapter id="File_Browsing_Support">
@@ -362,11 +361,12 @@
   </chapter>
 
   <chapter id="Date_Handling">
-    <title><emphasis>Date Handling</emphasis></title>
+    <title><emphasis>Date and Time Handling</emphasis></title>
 
     <xi:include href="ECLStandardLibraryReference/SLR-Mods/DateDataTypes.xml"
                 xmlns:xi="http://www.w3.org/2001/XInclude" />
-
+    <xi:include href="ECLStandardLibraryReference/SLR-Mods/TimeDataTypes.xml"
+                xmlns:xi="http://www.w3.org/2001/XInclude" />
     <xi:include href="ECLStandardLibraryReference/SLR-Mods/Year.xml"
                 xmlns:xi="http://www.w3.org/2001/XInclude" />
 
@@ -375,12 +375,19 @@
 
     <xi:include href="ECLStandardLibraryReference/SLR-Mods/Day.xml"
                 xmlns:xi="http://www.w3.org/2001/XInclude" />
+   <xi:include href="ECLStandardLibraryReference/SLR-Mods/Hour.xml"
+                xmlns:xi="http://www.w3.org/2001/XInclude" />
+   <xi:include href="ECLStandardLibraryReference/SLR-Mods/Minute.xml"
+                xmlns:xi="http://www.w3.org/2001/XInclude" />
+   <xi:include href="ECLStandardLibraryReference/SLR-Mods/Second.xml"
+                xmlns:xi="http://www.w3.org/2001/XInclude" />                
 
     <xi:include href="ECLStandardLibraryReference/SLR-Mods/DateFromParts.xml"
                 xmlns:xi="http://www.w3.org/2001/XInclude" />
 
     <xi:include href="ECLStandardLibraryReference/SLR-Mods/IsLeapYear.xml"
                 xmlns:xi="http://www.w3.org/2001/XInclude" />
+
     <xi:include href="ECLStandardLibraryReference/SLR-Mods/IsValidDate.xml"
                 xmlns:xi="http://www.w3.org/2001/XInclude" />
 
@@ -389,23 +396,27 @@
 
     <xi:include href="ECLStandardLibraryReference/SLR-Mods/ToGregorianYMD.xml"
                 xmlns:xi="http://www.w3.org/2001/XInclude" />
+
     <xi:include href="ECLStandardLibraryReference/SLR-Mods/FromStringToDate.xml"
-                xmlns:xi="http://www.w3.org/2001/XInclude" />            
+                xmlns:xi="http://www.w3.org/2001/XInclude" />
+
     <xi:include href="ECLStandardLibraryReference/SLR-Mods/Today.xml"
-                xmlns:xi="http://www.w3.org/2001/XInclude" />            
+                xmlns:xi="http://www.w3.org/2001/XInclude" />
+
     <xi:include href="ECLStandardLibraryReference/SLR-Mods/DayOfYear.xml"
-                xmlns:xi="http://www.w3.org/2001/XInclude" />            
+                xmlns:xi="http://www.w3.org/2001/XInclude" />
+
     <xi:include href="ECLStandardLibraryReference/SLR-Mods/DaysBetween.xml"
-                xmlns:xi="http://www.w3.org/2001/XInclude" />            
+                xmlns:xi="http://www.w3.org/2001/XInclude" />
+
     <xi:include href="ECLStandardLibraryReference/SLR-Mods/MonthsBetween.xml"
-                xmlns:xi="http://www.w3.org/2001/XInclude" />            
-    <xi:include href="ECLStandardLibraryReference/SLR-Mods/AdjustDate.xml"
-                xmlns:xi="http://www.w3.org/2001/XInclude" />            
-    <xi:include href="ECLStandardLibraryReference/SLR-Mods/AdjustCalendar.xml"
-                xmlns:xi="http://www.w3.org/2001/XInclude" />            
+                xmlns:xi="http://www.w3.org/2001/XInclude" />
 
+    <xi:include href="ECLStandardLibraryReference/SLR-Mods/AdjustDate.xml"
+                xmlns:xi="http://www.w3.org/2001/XInclude" />
 
-                
+    <xi:include href="ECLStandardLibraryReference/SLR-Mods/AdjustCalendar.xml"
+                xmlns:xi="http://www.w3.org/2001/XInclude" />
   </chapter>
 
   <chapter id="Cluster_Handling">