home *** CD-ROM | disk | FTP | other *** search
/ Meeting Pearls 3 / Meeting_Pearls_III.iso / Pearls / dev / Libraries / Date / src / DateClass.cpp < prev    next >
Encoding:
Text File  |  1995-07-31  |  131.5 KB  |  6,632 lines

  1. /* DateClass / Copyright 1995 by Kai Hofmann
  2. ******* DateClass/--history-- *************************************************
  3. *
  4. *   NAME
  5. *    history -- This is the development history of the Date class
  6. *
  7. *   VERSION
  8. *    $VER: DateClass 33.050 (30.07.95)
  9. *
  10. *   HISTORY
  11. *    26.05.1995 -    Initialization of the following class:
  12. *            timeduration
  13. *            Implementation of timeduration constructors,
  14. *            operator==,operator!=,operator==,operator!=,
  15. *            operator<,operator>,operator<=,operator>=,operator+,
  16. *            operator-,operator+=,operator-=
  17. *    27.05.1995 -    Initialization of the following class:
  18. *            dateduration
  19. *            Implementation of dateduration constructors
  20. *    30.05.1995 -    Implementation of operator==, operator!=, operator<,
  21. *            operator>, operator<=, operator>=, operator++,
  22. *            operator--, operator+, operator-, operator+=,
  23. *            operator-=, operator*, operator/, operator*=,
  24. *            operator/= for dateduration class
  25. *            Implementation of gethours(), getmins(), getsecs()
  26. *            for timeduration class
  27. *    02.06.1995 -    Fixing small bugs in timeduration constructors,
  28. *            operator-=
  29. *    03.06.1995 -    Implementing getdays(), getmonths(), getyears()
  30. *            for dateduration
  31. *            Removing one of the dateduration constructors
  32. *            Fixing small bugs in operator<, operator>,
  33. *            operator<=, operator>=
  34. *    03.07.1995 -    Initialization of the following class:
  35. *            time
  36. *    07.07.1995 -    Initialization of the following class:
  37. *            date
  38. *            Implementation of time constructors,
  39. *            gethour(), getmin(), getsec(), getzone(), getjd(),
  40. *            operator==, operator!=, operator<, operator>,
  41. *            operator<=, operator>=, operator-, operator+,
  42. *            operator-, operator+=, operator-=
  43. *            Implementation of date constructors,
  44. *            getday(), getmonth(), getyear(), getweek(),
  45. *            getweekday(), getjd(), getmjd(), getscaliger(),
  46. *            operator==, operator!=, operator<, operator>,
  47. *            operator<=, operator>=, operator==, operator!=,
  48. *            operator<, operator>, operator<=, operator>=,
  49. *            operator!, operator-, operator+, operator-,
  50. *            operator+=, operator-=, operator+, operator-,
  51. *            operator+=, operator-=, changetozone(), operator<<,
  52. *            operator>>, operator<<=, operator>>=, operator[],
  53. *            operator()
  54. *            Implementation of timeduration getinsecs()
  55. *            Implementation of dateduration getindays()
  56. *            Optimizations
  57. *    08.07.1995 -    Fixing bugs in time
  58. *            operator<<, operator>>, operator<<=, operator>>=,
  59. *            operator[], opertaor(), changetozone(), operator-,
  60. *            operator+, operator-
  61. *    09.07.1995 -    I found a BUG in the SAS C++ translator, and so I
  62. *            lost all the source from the DateClass.cpp :(
  63. *            Completely reconstructed in 8 hours!
  64. *    10.07.1995 -    Start to writing autodocs
  65. *    14.07.1995 -    Workaround for the SAS C++ enum problem in Date.c
  66. *    15.07.1995 -    Continuing with writing autodocs
  67. *    16.07.1995 -    Continuing with writing autodocs
  68. *    17.07.1995 -    Finishing with writing autodocs
  69. *    18.07.1995 -    Fixing conversion warnings.
  70. *    27.07.1995 -    Correcting my rusty English in the Autodocs.
  71. *            Implementing of timeduration operators:
  72. *            operator*,operator/,operator*=,operator/=
  73. *    28.07.1995 -    Shortening the year of the version-string to 95,
  74. *            because the Amiga 'version' command is buggy!
  75. *            Removing the changetozone() function from the time
  76. *            class, because it's better to use the operator[].
  77. *            Starting to write a test program.
  78. *    29.07.1995 -    Implementing Easter()
  79. *            Implementing of date functions:
  80. *            getmoonage(),getmoonphase()
  81. *            Implementing of timeduration operator:
  82. *            operator/()
  83. *            Implementing of dateduration operator:
  84. *            operator/()
  85. *    30.07.1995 -    Implementing of timeduration operator:
  86. *            operator%()
  87. *            Implementing of dateduration operator:
  88. *            operator%()
  89. *            Fixing bugs (Thanks to Christian Schaefer for spending
  90. *            time on this class with Borland C++ 4.5)
  91. *
  92. ******************************************************************************/
  93.  
  94. /****** DateClass/--todo-- ****************************************************
  95. *
  96. *   NAME
  97. *    todo -- This is the 'To-Do' list of the Date class
  98. *
  99. *   TODO
  100. *    Writing a test programm
  101. *    Writing code for string operations/TextEngine
  102. *    Derive a datetime class
  103. *    Derive a datetimeduration class
  104. *    Variable durations (2-3h)
  105. *    Variable time points (18. or 19.3.)
  106. *    Alternatives
  107. *    etc. (that's top secret ;-)
  108. *
  109. ******************************************************************************/
  110.  
  111. /****** DateClass/--compiling-- ***********************************************
  112. *
  113. *   NAME
  114. *    compiling -- Specials for compiling the date class.
  115. *
  116. *   COMPILING
  117. *    - Compile the date library as C++ !!!
  118. *    - You could compile this code as normal C++
  119. *    - _ISO8859_Latin1 should be defined if your system supports this
  120. *      font encoding technology!
  121. *    - Date.h will be included automatically!
  122. *
  123. ******************************************************************************/
  124.  
  125. /****** DateClass/--background-- **********************************************
  126. *
  127. *   NAME
  128. *    DateClass -- This class was designed to help calc. cal. dates (V33)
  129. *
  130. *   FUNCTION
  131. *    This class has been designed to become a useful and portable class
  132. *    and to help developers handle calendar dates!
  133. *
  134. *   NOTES
  135. *    This class is based on the date library copyrighted 1994-95 by
  136. *    Kai Hofmann.
  137. *
  138. *   COPYRIGHT
  139. *    This software is copyrighted 1995 by Kai Hofmann.
  140. *    All rights reserved!
  141. *
  142. *    - Permission for COMMERCIAL USE is only given by an extra available
  143. *      commercial license that must be validated!
  144. *      Contact me directly for this license, because it will be
  145. *      individually handed out per your needs!
  146. *
  147. *    - Permission is hereby granted, without written agreement and without
  148. *      license, to USE this software and its documentation for any
  149. *      NON-COMMERCIAL purpose, provided that the above copyright notice
  150. *      and the following paragraph appear in all copies of this software
  151. *      (Non-commercial includes Giftware and Shareware!).
  152. *
  153. *      You *must* include the following notice in your product and in your
  154. *      documentation:
  155. *      "This software uses the date class that is copyrighted 1994-95 by
  156. *       Kai Hofmann"
  157. *
  158. *      You "must" send me a full version of your product at no cost
  159. *      including free updates!
  160. *      Extra money is welcome (For Bank Account see below - but *ONLY*
  161. *      send in DM to this Bank Account!).
  162. *
  163. *    - THERE IS *NO PERMISSION* GIVEN TO MODIFY THIS SOFTWARE!
  164. *
  165. *      If you need only parts of this software, you should not worry,
  166. *      because it's the job of the optimizer from your C compiler to
  167. *      include only the needed parts in your executable!
  168. *
  169. *   DISCLAIMER
  170. *    THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
  171. *    APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
  172. *    HOLDER AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT
  173. *    WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
  174. *    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  175. *    A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
  176. *    PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE
  177. *    DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
  178. *    CORRECTION.
  179. *
  180. *    IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
  181. *    WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY REDISTRIBUTE
  182. *    THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
  183. *    INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
  184. *    ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING
  185. *    BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR
  186. *    LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM
  187. *    TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
  188. *    PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
  189. *
  190. *    THE AUTHOR HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT,
  191. *    UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  192. *
  193. *   DISTRIBUTION
  194. *    Permission is hereby granted, without written agreement and without
  195. *    license or royalty fees, to copy and distribute this software and its
  196. *    documentation for any purpose, provided that the above copyright
  197. *    notice and the following paragraphs appear in all copies of this
  198. *    software, to:
  199. *    - All who will distribute this software for free!
  200. *    - All free accessible INTERNET servers and PHONE boxes!
  201. *    - All Aminet sites
  202. *    - All SimTel sites
  203. *    - Fred Fish for his great Amiga-Software-Library
  204. *    - The German SAAR AG PD-Library
  205. *    - All others who do NOT take more than $5.- for one disk that
  206. *      includes this software!
  207. *    - ALL others who do NOT take more than $40.- for one CD that includes
  208. *      this software!
  209. *
  210. *   ADDITIONAL INFORMATIONS
  211. *    I have tried to make portable/useful and I hope bugfree software
  212. *    for eternity - but this seems to be impossible (sorry!) :)
  213. *    So I hope you will pay a fee for this.
  214. *
  215. *    Kindly send US - dollars to a friend of mine in the USA who will
  216. *    forward it to me in a timely manner.  Please send checks or money
  217. *    orders only.
  218. *    Contact me via email for more!
  219. *
  220. *   AUTHOR
  221. *    Kai Hofmann
  222. *    Arberger Heerstraße 92
  223. *    28307 Bremen
  224. *    Germany
  225. *
  226. *    Phone: (+49)-(0)421/480780
  227. *           (Remember that my parents don't speak english!)
  228. *    EMail: i07m@zfn.uni-bremen.de
  229. *           i07m@informatik.uni-bremen.de
  230. *    IRC  : PowerStat@#AmigaGer
  231. *    WWW  : http://www.informatik.uni-bremen.de/~i07m
  232. *
  233. *    Bank account : 1203 7503
  234. *    Account owner: Kai Hofmann
  235. *    Bank code    : 290 501 01
  236. *    Bank name    : Sparkasse in Bremen/Germany
  237. *
  238. *    THANKS
  239. *    Many thanks to the following people:
  240. *    Rita Reichl        - For correcting my rusty english (very often)
  241. *    Christian Schaefer    - For spending time on this class with his
  242. *                  Borland C++ 4.5 compiler
  243. *    Jacco van Weert &
  244. *    Frans Slothouber    - For the 'Robodoc' utility
  245. *    James Cooper and the
  246. *    other Amiga people at
  247. *    SAS Intitute        - For spending their unpaid free time with
  248. *                  continuation of the Amiga SAS C/C++
  249. *                  support :)
  250. *
  251. ******************************************************************************/
  252.  
  253.  
  254.  #include "DateClass.h"
  255.  
  256.  
  257.  /* --- timeduration ------------------------------------------------------ */
  258.  
  259. /****** DateClass/timeduration ************************************************
  260. *
  261. *   NAME
  262. *    timeduration -- Class for time durations (V33)
  263. *
  264. *   FUNCTION
  265. *    This class maps the concept of time durations.
  266. *
  267. *   NOTES
  268. *    None.
  269. *
  270. *   BUGS
  271. *    No known bugs.
  272. *
  273. *   SEE ALSO
  274. *    dateduration,time,date
  275. *
  276. ******************************************************************************/
  277.  
  278. /****i* DateClass/timeduration/struct timeduration ****************************
  279. *
  280. *   NAME
  281. *    struct timeduration -- Private structure of timeduration class (V33)
  282. *
  283. *   SYNOPSIS
  284. *    struct timeduration {
  285. *                 unsigned short days,hours,mins,secs;
  286. *                };
  287. *
  288. *   FUNCTION
  289. *    This structure holds the data of a time duration.
  290. *
  291. *   ELEMENTS
  292. *    days  - Number of days in a time duration, only for overruns.
  293. *    hours - Number of hours in a time duration.
  294. *    mins  - Number of mins in a time duration.
  295. *    secs  - Number of secs in a time duration.
  296. *
  297. *   NOTES
  298. *    None.
  299. *
  300. *   BUGS
  301. *    No known bugs.
  302. *
  303. *   SEE ALSO
  304. *    timeduration(),operator==(),operator!=(),operator<(),operator>(),
  305. *    operator<=(),operator>=(),operator+(),operator-(),operator+=(),
  306. *    operator-=(),gethours(),getmins(),getsecs(),getinsecs(),date
  307. *
  308. ******************************************************************************/
  309.  
  310.  
  311.  timeduration::timeduration(unsigned short days, unsigned short hours, unsigned short mins, unsigned short secs)
  312.  
  313. /****i* DateClass/timeduration/timeduration() *********************************
  314. *
  315. *   NAME
  316. *    timeduration() -- Private constructor of timeduration class (V33)
  317. *
  318. *   SYNOPSIS
  319. *    td = timeduration(days,hours,mins,secs);
  320. *
  321. *    timeduration(unsigned short days, unsigned short hours,
  322. *        unsigned short mins, unsigned short secs);
  323. *
  324. *   FUNCTION
  325. *    This is a privat constructor for the timeduration class.
  326. *
  327. *   INPUTS
  328. *    days  - Days of a timeduration
  329. *    hours - Hours of a timeduration
  330. *    mins  - Mins of a timeduration
  331. *    secs  - Secs of a timeduration
  332. *
  333. *   RESULT
  334. *    td - Timeduration object
  335. *
  336. *   EXAMPLE
  337. *    ...
  338. *    timeduration td(0,2,0,0);
  339. *    ...
  340. *
  341. *   NOTES
  342. *    None.
  343. *
  344. *   BUGS
  345. *    No known bugs.
  346. *
  347. *   SEE ALSO
  348. *    timeduration()
  349. *
  350. ******************************************************************************/
  351.  
  352.   {
  353.    this->days = days;
  354.    this->hours = hours;
  355.    this->mins = mins;
  356.    this->secs = secs;
  357.   }
  358.  
  359.  
  360.  timeduration::timeduration(float jd)
  361.  
  362. /****** DateClass/timeduration/timeduration() *********************************
  363. *
  364. *   NAME
  365. *    timeduration() -- Constructor of timeduration class (V33)
  366. *
  367. *   SYNOPSIS
  368. *    td = timeduration(jd);
  369. *
  370. *    timeduration(float jd);
  371. *
  372. *   FUNCTION
  373. *    Constructor of the timeduration class using the JD format.
  374. *
  375. *   INPUTS
  376. *    jd - Timeduration in JD format
  377. *
  378. *   RESULT
  379. *    td - Timeduration object
  380. *
  381. *   EXAMPLE
  382. *    ...
  383. *    timeduration td(0.5);
  384. *    ...
  385. *
  386. *   NOTES
  387. *    None.
  388. *
  389. *   BUGS
  390. *    No known bugs.
  391. *
  392. *   SEE ALSO
  393. *    timeduration(),Date/JDToTime()
  394. *
  395. ******************************************************************************/
  396.  
  397.   {
  398.    this->days = 0;
  399.    JDToTime(jd,this->hours,this->mins,this->secs);
  400.   }
  401.  
  402.  
  403.  timeduration::timeduration(double jd)
  404.  
  405. /****** DateClass/timeduration/timeduration() *********************************
  406. *
  407. *   NAME
  408. *    timeduration() -- Constructor of timeduration class (V33)
  409. *
  410. *   SYNOPSIS
  411. *    td = timeduration(jd);
  412. *
  413. *    timeduration(double jd);
  414. *
  415. *   FUNCTION
  416. *    Constructor of the timeduration class using the JD format.
  417. *
  418. *   INPUTS
  419. *    jd - Timeduration in JD format
  420. *
  421. *   RESULT
  422. *    td - Timeduration object
  423. *
  424. *   EXAMPLE
  425. *    ...
  426. *    timeduration td(0.5);
  427. *    ...
  428. *
  429. *   NOTES
  430. *    None.
  431. *
  432. *   BUGS
  433. *    No known bugs.
  434. *
  435. *   SEE ALSO
  436. *    timeduration(),Date/JDToTime()
  437. *
  438. ******************************************************************************/
  439.  
  440.   {
  441.    this->days = 0;
  442.    JDToTime((float)jd,this->hours,this->mins,this->secs);
  443.   }
  444.  
  445.  
  446.  timeduration::timeduration(unsigned short hours, unsigned short mins, unsigned short secs)
  447.  
  448. /****** DateClass/timeduration/timeduration() *********************************
  449. *
  450. *   NAME
  451. *    timeduration() -- Constructor of timeduration class (V33)
  452. *
  453. *   SYNOPSIS
  454. *    td = timeduration(hours=0,mins=0,secs=0);
  455. *
  456. *    timeduration(unsigned short hours=0, unsigned short mins=0,
  457. *        unsigned short secs=0);
  458. *
  459. *   FUNCTION
  460. *    Constructor of the timeduration class.
  461. *
  462. *   INPUTS
  463. *    hours - Hours of a timeduration
  464. *    mins  - Mins of a timeduration
  465. *    secs  - Secs of a timeduration
  466. *
  467. *   RESULT
  468. *    td - Timeduration object
  469. *
  470. *   EXAMPLE
  471. *    ...
  472. *    timeduration td(2,30,0);
  473. *    ...
  474. *
  475. *   NOTES
  476. *    None.
  477. *
  478. *   BUGS
  479. *    No known bugs.
  480. *
  481. *   SEE ALSO
  482. *    timeduration(),Date/SecToTime()
  483. *
  484. ******************************************************************************/
  485.  
  486.   {
  487.    this->days = 0;
  488.    SecToTime(TimeToSec(hours,mins,secs),this->hours,this->mins,this->secs);
  489.    while (this->hours >= 24)
  490.     {
  491.      this->hours -= 24;
  492.      this->days++;
  493.     }
  494.   }
  495.  
  496.  
  497.  bool timeduration::operator==(const timeduration &td) const
  498.  
  499. /****** DateClass/timeduration/operator==() ***********************************
  500. *
  501. *   NAME
  502. *    operator==() -- Equal operator for timeduration objects (V33)
  503. *
  504. *   SYNOPSIS
  505. *    compare = ((*this) == td);
  506. *
  507. *    bool operator==(const timeduration &td) const;
  508. *
  509. *   FUNCTION
  510. *    Compares two timeduration objects for equality.
  511. *
  512. *   INPUTS
  513. *    *this - timeduration object
  514. *    td    - timeduration object
  515. *
  516. *   RESULT
  517. *    compare - Boolean result of the equal compare operation
  518. *
  519. *   EXAMPLE
  520. *    ...
  521. *    if (td1 == td2)
  522. *      printf("==\n");
  523. *    else
  524. *      printf("!=\n");
  525. *    ...
  526. *
  527. *   NOTES
  528. *    None.
  529. *
  530. *   BUGS
  531. *    No known bugs.
  532. *
  533. *   SEE ALSO
  534. *    operator!=(),operator<(),operator>(),operator<=(),operator>=(),
  535. *    Date/Compare2Times()
  536. *
  537. ******************************************************************************/
  538.  
  539.   {
  540.    return(Compare2Times(this->hours,this->mins,this->secs,td.hours,td.mins,td.secs) == 0);
  541.   }
  542.  
  543.  
  544.  bool timeduration::operator!=(const timeduration &td) const
  545.  
  546. /****** DateClass/timeduration/operator!=() ***********************************
  547. *
  548. *   NAME
  549. *    operator!=() -- Unequal operator for timeduration objects (V33)
  550. *
  551. *   SYNOPSIS
  552. *    compare = ((*this) != td);
  553. *
  554. *    bool operator!=(const timeduration &td) const;
  555. *
  556. *   FUNCTION
  557. *    Compares two timeduration objects for unequality.
  558. *
  559. *   INPUTS
  560. *    *this - timeduration object
  561. *    td    - timeduration object
  562. *
  563. *   RESULT
  564. *    compare - Boolean result of the unequal compare operation
  565. *
  566. *   EXAMPLE
  567. *    ...
  568. *    if (td1 != td2)
  569. *      printf("!=\n");
  570. *    else
  571. *      printf("==\n");
  572. *    ...
  573. *
  574. *   NOTES
  575. *    None.
  576. *
  577. *   BUGS
  578. *    No known bugs.
  579. *
  580. *   SEE ALSO
  581. *    operator==(),operator<(),operator>(),operator<=(),operator>=(),
  582. *    Date/Compare2Times()
  583. *
  584. ******************************************************************************/
  585.  
  586.   {
  587.    return(Compare2Times(this->hours,this->mins,this->secs,td.hours,td.mins,td.secs) != 0);
  588.   }
  589.  
  590.  
  591.  bool timeduration::operator< (const timeduration &td) const
  592.  
  593. /****** DateClass/timeduration/operator<() ************************************
  594. *
  595. *   NAME
  596. *    operator<() -- Lower than operator for timeduration objects (V33)
  597. *
  598. *   SYNOPSIS
  599. *    compare = ((*this) < td);
  600. *
  601. *    bool operator<(const timeduration &td) const;
  602. *
  603. *   FUNCTION
  604. *    Compares if timeduration object 1 is lower than timeduration object 2.
  605. *
  606. *   INPUTS
  607. *    *this - timeduration object
  608. *    td    - timeduration object
  609. *
  610. *   RESULT
  611. *    compare - Boolean result of the lower than compare operation
  612. *
  613. *   EXAMPLE
  614. *    ...
  615. *    if (td1 < td2)
  616. *      printf("<\n");
  617. *    else
  618. *      printf(">=\n");
  619. *    ...
  620. *
  621. *   NOTES
  622. *    None.
  623. *
  624. *   BUGS
  625. *    No known bugs.
  626. *
  627. *   SEE ALSO
  628. *    operator==(),operator!=(),operator>(),operator<=(),operator>=(),
  629. *    Date/Compare2Times()
  630. *
  631. ******************************************************************************/
  632.  
  633.   {
  634.    return(Compare2Times(this->hours,this->mins,this->secs,td.hours,td.mins,td.secs) == -1);
  635.   }
  636.  
  637.  
  638.  bool timeduration::operator> (const timeduration &td) const
  639.  
  640. /****** DateClass/timeduration/operator>() ************************************
  641. *
  642. *   NAME
  643. *    operator>() -- Greater than operator for timeduration objects (V33)
  644. *
  645. *   SYNOPSIS
  646. *    compare = ((*this) > td);
  647. *
  648. *    bool operator>(const timeduration &td) const;
  649. *
  650. *   FUNCTION
  651. *    Compares if timeduration object 1 is greater than timeduration
  652. *    object 2.
  653. *
  654. *   INPUTS
  655. *    *this - timeduration object
  656. *    td    - timeduration object
  657. *
  658. *   RESULT
  659. *    compare - Boolean result of the greater than compare operation
  660. *
  661. *   EXAMPLE
  662. *    ...
  663. *    if (td1 > td2)
  664. *      printf(">\n");
  665. *    else
  666. *      printf("<=\n");
  667. *    ...
  668. *
  669. *   NOTES
  670. *    None.
  671. *
  672. *   BUGS
  673. *    No known bugs.
  674. *
  675. *   SEE ALSO
  676. *    operator==(),operator!=(),operator<(),operator<=(),operator>=(),
  677. *    Date/Compare2Times()
  678. *
  679. ******************************************************************************/
  680.  
  681.   {
  682.    return(Compare2Times(this->hours,this->mins,this->secs,td.hours,td.mins,td.secs) == 1);
  683.   }
  684.  
  685.  
  686.  bool timeduration::operator<=(const timeduration &td) const
  687.  
  688. /****** DateClass/timeduration/operator<=()
  689. *
  690. *   NAME
  691. *    operator<=() -- Lower or equal operator for timeduration objects (V33)
  692. *
  693. *   SYNOPSIS
  694. *    compare = ((*this) <= td);
  695. *
  696. *    bool operator<=(const timeduration &td) const;
  697. *
  698. *   FUNCTION
  699. *    Compares if timeduration object 1 is lower or equal than timeduration
  700. *    object 2.
  701. *
  702. *   INPUTS
  703. *    *this - timeduration object
  704. *    td    - timeduration object
  705. *
  706. *   RESULT
  707. *    compare - Boolean result of the lower or equal compare operation
  708. *
  709. *   EXAMPLE
  710. *    ...
  711. *    if (td1 <= td2)
  712. *      printf("<=\n");
  713. *    else
  714. *      printf(">\n");
  715. *    ...
  716. *
  717. *   NOTES
  718. *    None.
  719. *
  720. *   BUGS
  721. *    No known bugs.
  722. *
  723. *   SEE ALSO
  724. *    operator==(),operator!=(),operator<(),operator>(),operator>=(),
  725. *    Date/Compare2Times()
  726. *
  727. ******************************************************************************/
  728.  
  729.   {
  730.    return(Compare2Times(this->hours,this->mins,this->secs,td.hours,td.mins,td.secs) <= 0);
  731.   }
  732.  
  733.  
  734.  bool timeduration::operator>=(const timeduration &td) const
  735.  
  736. /****** DateClass/timeduration/operator>=() ***********************************
  737. *
  738. *   NAME
  739. *    operator>=() -- Greater or equal operator for timeduration objs (V33)
  740. *
  741. *   SYNOPSIS
  742. *    compare = ((*this) >= td);
  743. *
  744. *    bool operator>=(const timeduration &td) const;
  745. *
  746. *   FUNCTION
  747. *    Compares if timeduration object 1 is greater or equal than timeduration
  748. *    object 2.
  749. *
  750. *   INPUTS
  751. *    *this - timeduration object
  752. *    td    - timeduration object
  753. *
  754. *   RESULT
  755. *    compare - Boolean result of the greater or equal compare operation
  756. *
  757. *   EXAMPLE
  758. *    ...
  759. *    if (td1 >= td2)
  760. *      printf(">=\n");
  761. *    else
  762. *      printf("<\n");
  763. *    ...
  764. *
  765. *   NOTES
  766. *    None.
  767. *
  768. *   BUGS
  769. *    No known bugs.
  770. *
  771. *   SEE ALSO
  772. *    operator==(),operator!=(),operator<(),operator>(),operator<=(),
  773. *    Date/Compare2Times()
  774. *
  775. ******************************************************************************/
  776.  
  777.   {
  778.    return(Compare2Times(this->hours,this->mins,this->secs,td.hours,td.mins,td.secs) >= 0);
  779.   }
  780.  
  781.  
  782.  timeduration timeduration::operator+(const timeduration &td) const
  783.  
  784. /****** DateClass/timeduration/operator+() ************************************
  785. *
  786. *   NAME
  787. *    operator+() -- Add operator for timeduration objects (V33)
  788. *
  789. *   SYNOPSIS
  790. *    tdres = (*this) + td;
  791. *
  792. *    timeduration operator+(const timeduration &td) const;
  793. *
  794. *   FUNCTION
  795. *    Add two timeduration objects to a new timeduration object.
  796. *
  797. *   INPUTS
  798. *    *this - timeduration object
  799. *    td    - timeduration object
  800. *
  801. *   RESULT
  802. *    tdres - new timeduration object
  803. *
  804. *   EXAMPLE
  805. *    ...
  806. *    tdres = td1 + td2;
  807. *    ...
  808. *
  809. *   NOTES
  810. *    None.
  811. *
  812. *   BUGS
  813. *    No known bugs.
  814. *
  815. *   SEE ALSO
  816. *    operator-(),operator+=(),operator-=(),timeduration(),Date/TimeToSec(),
  817. *    Date/SecToTime()
  818. *
  819. ******************************************************************************/
  820.  
  821.   {
  822.    unsigned short days=0,hours,mins,secs;
  823.    unsigned long hsecs = TimeToSec(this->hours,this->mins,this->secs) + TimeToSec(td.hours,td.mins,td.secs);
  824.  
  825.    SecToTime(hsecs,hours,mins,secs);
  826.    while (hours >= 24)
  827.     {
  828.      hours -= 24;
  829.      days++;
  830.     }
  831.    return(timeduration(days,hours,mins,secs));
  832.   }
  833.  
  834.  
  835.  timeduration timeduration::operator-(const timeduration &td) const
  836.  
  837. /****** DateClass/timeduration/operator-() ************************************
  838. *
  839. *   NAME
  840. *    operator-() -- Sub operator for timeduration objects (V33)
  841. *
  842. *   SYNOPSIS
  843. *    tdres = (*this) - td;
  844. *
  845. *    timeduration operator-(const timeduration &td) const;
  846. *
  847. *   FUNCTION
  848. *    Difference between two timeduration objects to a new timeduration
  849. *    object.
  850. *
  851. *   INPUTS
  852. *    *this - timeduration object
  853. *    td    - timeduration object
  854. *
  855. *   RESULT
  856. *    tdres - new timeduration object
  857. *
  858. *   EXAMPLE
  859. *    ...
  860. *    tdres = td1 - td2;
  861. *    ...
  862. *
  863. *   NOTES
  864. *    None.
  865. *
  866. *   BUGS
  867. *    No known bugs.
  868. *
  869. *   SEE ALSO
  870. *    operator+(),operator+=(),operator-=(),timeduration(),Date/TimeDiff()
  871. *    Date/SecToTime()
  872. *
  873. ******************************************************************************/
  874.  
  875.   {
  876.    unsigned short hours,mins,secs;
  877.    long hsecs = TimeDiff(this->hours,this->mins,this->secs,td.hours,td.mins,td.secs);
  878.  
  879.    if (hsecs < 0)
  880.      hsecs = -hsecs;
  881.    SecToTime(hsecs,hours,mins,secs);
  882.    return(timeduration(hours,mins,secs));
  883.   }
  884.  
  885.  
  886.  const timeduration &timeduration::operator+=(const timeduration &td)
  887.  
  888. /****** DateClass/timeduration/operator+=() ***********************************
  889. *
  890. *   NAME
  891. *    operator+=() -- Add to operator for timeduration objects (V33)
  892. *
  893. *   SYNOPSIS
  894. *    (*this) += td;
  895. *
  896. *    const timeduration &operator+=(const timeduration &td);
  897. *
  898. *   FUNCTION
  899. *    Add timeduration object 2 to timeduration object 1.
  900. *
  901. *   INPUTS
  902. *    *this - timeduration object
  903. *    td    - timeduration object
  904. *
  905. *   RESULT
  906. *    *this - modified timeduration object
  907. *
  908. *   EXAMPLE
  909. *    ...
  910. *    td1 += td2;
  911. *    ...
  912. *
  913. *   NOTES
  914. *    None.
  915. *
  916. *   BUGS
  917. *    No known bugs.
  918. *
  919. *   SEE ALSO
  920. *    operator+(),operator-(),operator-=(),Date/TimeToSec(),Date/SecToTime()
  921. *
  922. ******************************************************************************/
  923.  
  924.   {
  925.    unsigned long hsecs = TimeToSec(this->hours,this->mins,this->secs) + TimeToSec(td.hours,td.mins,td.secs);
  926.  
  927.    SecToTime(hsecs,this->hours,this->mins,this->secs);
  928.    while (this->hours >= 24)
  929.     {
  930.      this->hours -= 24;
  931.      this->days++;
  932.     }
  933.    return(*this);
  934.   }
  935.  
  936.  
  937.  const timeduration &timeduration::operator-=(const timeduration &td)
  938.  
  939. /****** DateClass/timeduration/operator-=() ***********************************
  940. *
  941. *   NAME
  942. *    operator-=() -- Sub from operator for timeduration objects (V33)
  943. *
  944. *   SYNOPSIS
  945. *    (*this) -= td;
  946. *
  947. *    const timeduration &operator-=(const timeduration &td);
  948. *
  949. *   FUNCTION
  950. *    Difference between two timeduration objects.
  951. *
  952. *   INPUTS
  953. *    *this - timeduration object
  954. *    td    - timeduration object
  955. *
  956. *   RESULT
  957. *    *this - modified timeduration object
  958. *
  959. *   EXAMPLE
  960. *    ...
  961. *    td1 -= td2;
  962. *    ...
  963. *
  964. *   NOTES
  965. *    None.
  966. *
  967. *   BUGS
  968. *    No known bugs.
  969. *
  970. *   SEE ALSO
  971. *    operator+(),operator-(),operator+=(),Date/TimeDiff(),Date/SecToTime()
  972. *
  973. ******************************************************************************/
  974.  
  975.   {
  976.    long hsecs = TimeDiff(this->hours,this->mins,this->secs,td.hours,td.mins,td.secs);
  977.  
  978.    if (hsecs < 0)
  979.      hsecs = -hsecs;
  980.    SecToTime(hsecs,this->hours,this->mins,this->secs);
  981.    return(*this);
  982.   }
  983.  
  984.  
  985.  timeduration timeduration::operator*(const unsigned short tdm) const
  986.  
  987. /****** DateClass/timeduration/operator*() ************************************
  988. *
  989. *   NAME
  990. *    operator*() -- Multiply operator for timeduration object (V33)
  991. *
  992. *   SYNOPSIS
  993. *    tdres = (*this) * tdm;
  994. *
  995. *    timeduration operator*(const unsigned short tdm) const;
  996. *
  997. *   FUNCTION
  998. *    Muliply the timeeduration object with a constant value to a new
  999. *    timeduration object.
  1000. *
  1001. *   INPUTS
  1002. *    *this - timeduration object
  1003. *    tdm   - Multiplication factor
  1004. *
  1005. *   RESULT
  1006. *    tdres - new timeduration object
  1007. *
  1008. *   EXAMPLE
  1009. *    ...
  1010. *    tdres = td * 2;
  1011. *    ...
  1012. *
  1013. *   NOTES
  1014. *    None.
  1015. *
  1016. *   BUGS
  1017. *    No known bugs.
  1018. *
  1019. *   SEE ALSO
  1020. *    operator+(),operator-(),operator+=(),operator-=(),operator/(),
  1021. *    operator*=(),operator/=(),timeduration(),Date/TimeToSec(),
  1022. *    Date/SecToTime()
  1023. *
  1024. ******************************************************************************/
  1025.  
  1026.   {
  1027.    unsigned short days=0,hours,mins,secs;
  1028.    unsigned long hsecs = TimeToSec(this->hours,this->mins,this->secs) * tdm;
  1029.  
  1030.    SecToTime(hsecs,hours,mins,secs);
  1031.    while (hours >= 24)
  1032.     {
  1033.      hours -= 24;
  1034.      days++;
  1035.     }
  1036.    return(timeduration(days,hours,mins,secs));
  1037.   }
  1038.  
  1039.  
  1040.  timeduration timeduration::operator*(const unsigned int tdm) const
  1041.  
  1042. /****** DateClass/timeduration/operator*() ************************************
  1043. *
  1044. *   NAME
  1045. *    operator*() -- Multiply operator for timeduration object (V33)
  1046. *
  1047. *   SYNOPSIS
  1048. *    tdres = (*this) * tdm;
  1049. *
  1050. *    timeduration operator*(const unsigned int tdm) const;
  1051. *
  1052. *   FUNCTION
  1053. *    Muliply the timeeduration object with a constant value to a new
  1054. *    timeduration object.
  1055. *
  1056. *   INPUTS
  1057. *    *this - timeduration object
  1058. *    tdm   - Multiplication factor
  1059. *
  1060. *   RESULT
  1061. *    tdres - new timeduration object
  1062. *
  1063. *   EXAMPLE
  1064. *    ...
  1065. *    tdres = td * 2;
  1066. *    ...
  1067. *
  1068. *   NOTES
  1069. *    None.
  1070. *
  1071. *   BUGS
  1072. *    No known bugs.
  1073. *
  1074. *   SEE ALSO
  1075. *    operator+(),operator-(),operator+=(),operator-=(),operator/(),
  1076. *    operator*=(),operator/=(),timeduration(),Date/TimeToSec(),
  1077. *    Date/SecToTime()
  1078. *
  1079. ******************************************************************************/
  1080.  
  1081.   {
  1082.    unsigned short days=0,hours,mins,secs;
  1083.    unsigned long hsecs = TimeToSec(this->hours,this->mins,this->secs) * tdm;
  1084.  
  1085.    SecToTime(hsecs,hours,mins,secs);
  1086.    while (hours >= 24)
  1087.     {
  1088.      hours -= 24;
  1089.      days++;
  1090.     }
  1091.    return(timeduration(days,hours,mins,secs));
  1092.   }
  1093.  
  1094.  
  1095.  timeduration timeduration::operator*(const unsigned long tdm) const
  1096.  
  1097. /****** DateClass/timeduration/operator*() ************************************
  1098. *
  1099. *   NAME
  1100. *    operator*() -- Multiply operator for timeduration object (V33)
  1101. *
  1102. *   SYNOPSIS
  1103. *    tdres = (*this) * tdm;
  1104. *
  1105. *    timeduration operator*(const unsigned long tdm) const;
  1106. *
  1107. *   FUNCTION
  1108. *    Muliply the timeeduration object with a constant value to a new
  1109. *    timeduration object.
  1110. *
  1111. *   INPUTS
  1112. *    *this - timeduration object
  1113. *    tdm   - Multiplication factor
  1114. *
  1115. *   RESULT
  1116. *    tdres - new timeduration object
  1117. *
  1118. *   EXAMPLE
  1119. *    ...
  1120. *    tdres = td * 2;
  1121. *    ...
  1122. *
  1123. *   NOTES
  1124. *    None.
  1125. *
  1126. *   BUGS
  1127. *    No known bugs.
  1128. *
  1129. *   SEE ALSO
  1130. *    operator+(),operator-(),operator+=(),operator-=(),operator/(),
  1131. *    operator*=(),operator/=(),timeduration(),Date/TimeToSec(),
  1132. *    Date/SecToTime()
  1133. *
  1134. ******************************************************************************/
  1135.  
  1136.   {
  1137.    unsigned short days=0,hours,mins,secs;
  1138.    unsigned long hsecs = TimeToSec(this->hours,this->mins,this->secs) * tdm;
  1139.  
  1140.    SecToTime(hsecs,hours,mins,secs);
  1141.    while (hours >= 24)
  1142.     {
  1143.      hours -= 24;
  1144.      days++;
  1145.     }
  1146.    return(timeduration(days,hours,mins,secs));
  1147.   }
  1148.  
  1149.  
  1150.  timeduration timeduration::operator/(const unsigned short tdd) const
  1151.  
  1152. /****** DateClass/timeduration/operator/() ************************************
  1153. *
  1154. *   NAME
  1155. *    operator/() -- Div operator for timeduration object (V33)
  1156. *
  1157. *   SYNOPSIS
  1158. *    tdres = (*this) / tdd;
  1159. *
  1160. *    timeduration operator/(const unsigned short tdd) const;
  1161. *
  1162. *   FUNCTION
  1163. *    Devide the timeeduration object by a constant value to a new
  1164. *    timeeduration object.
  1165. *    If tdd is 0 you will get back an object with a duration of 0!
  1166. *
  1167. *   INPUTS
  1168. *    *this - timeduration object
  1169. *    tdd   - Division factor
  1170. *
  1171. *   RESULT
  1172. *    tdres - new timeduration object
  1173. *
  1174. *   EXAMPLE
  1175. *    ...
  1176. *    tdres = td / 2;
  1177. *    ...
  1178. *
  1179. *   NOTES
  1180. *    None.
  1181. *
  1182. *   BUGS
  1183. *    No known bugs.
  1184. *
  1185. *   SEE ALSO
  1186. *    operator+(),operator-(),operator+=(),operator-=(),operator*(),
  1187. *    operator*=(),operator/=(),timeduration(),Date/TimeToSec(),
  1188. *    Date/SecToTime()
  1189. *
  1190. ******************************************************************************/
  1191.  
  1192.   {
  1193.    if (tdd != 0)
  1194.     {
  1195.      unsigned short hours,mins,secs;
  1196.      unsigned long hsecs = TimeToSec(this->hours,this->mins,this->secs) / tdd;
  1197.  
  1198.      SecToTime(hsecs,hours,mins,secs);
  1199.      return(timeduration(days,hours,mins,secs));
  1200.     }
  1201.    else
  1202.      return(timeduration(0,0,0,0));
  1203.   }
  1204.  
  1205.  
  1206.  timeduration timeduration::operator/(const unsigned int tdd) const
  1207.  
  1208. /****** DateClass/timeduration/operator/() ************************************
  1209. *
  1210. *   NAME
  1211. *    operator/() -- Div operator for timeduration object (V33)
  1212. *
  1213. *   SYNOPSIS
  1214. *    tdres = (*this) / tdd;
  1215. *
  1216. *    timeduration operator/(const unsigned int tdd) const;
  1217. *
  1218. *   FUNCTION
  1219. *    Devide the timeeduration object by a constant value to a new
  1220. *    timeeduration object.
  1221. *    If tdd is 0 you will get back an object with a duration of 0!
  1222. *
  1223. *   INPUTS
  1224. *    *this - timeduration object
  1225. *    tdd   - Division factor
  1226. *
  1227. *   RESULT
  1228. *    tdres - new timeduration object
  1229. *
  1230. *   EXAMPLE
  1231. *    ...
  1232. *    tdres = td / 2;
  1233. *    ...
  1234. *
  1235. *   NOTES
  1236. *    None.
  1237. *
  1238. *   BUGS
  1239. *    No known bugs.
  1240. *
  1241. *   SEE ALSO
  1242. *    operator+(),operator-(),operator+=(),operator-=(),operator*(),
  1243. *    operator*=(),operator/=(),timeduration(),Date/TimeToSec(),
  1244. *    Date/SecToTime()
  1245. *
  1246. ******************************************************************************/
  1247.  
  1248.   {
  1249.    if (tdd != 0)
  1250.     {
  1251.      unsigned short hours,mins,secs;
  1252.      unsigned long hsecs = TimeToSec(this->hours,this->mins,this->secs) / tdd;
  1253.  
  1254.      SecToTime(hsecs,hours,mins,secs);
  1255.      return(timeduration(days,hours,mins,secs));
  1256.     }
  1257.    else
  1258.      return(timeduration(0,0,0,0));
  1259.   }
  1260.  
  1261.  
  1262.  timeduration timeduration::operator/(const unsigned long tdd) const
  1263.  
  1264. /****** DateClass/timeduration/operator/() ************************************
  1265. *
  1266. *   NAME
  1267. *    operator/() -- Div operator for timeduration object (V33)
  1268. *
  1269. *   SYNOPSIS
  1270. *    tdres = (*this) / tdd;
  1271. *
  1272. *    timeduration operator/(const unsigned long tdd) const;
  1273. *
  1274. *   FUNCTION
  1275. *    Devide the timeeduration object by a constant value to a new
  1276. *    timeeduration object.
  1277. *    If tdd is 0 you will get back an object with a duration of 0!
  1278. *
  1279. *   INPUTS
  1280. *    *this - timeduration object
  1281. *    tdd   - Division factor
  1282. *
  1283. *   RESULT
  1284. *    tdres - new timeduration object
  1285. *
  1286. *   EXAMPLE
  1287. *    ...
  1288. *    tdres = td / 2;
  1289. *    ...
  1290. *
  1291. *   NOTES
  1292. *    None.
  1293. *
  1294. *   BUGS
  1295. *    No known bugs.
  1296. *
  1297. *   SEE ALSO
  1298. *    operator+(),operator-(),operator+=(),operator-=(),operator*(),
  1299. *    operator*=(),operator/=(),timeduration(),Date/TimeToSec(),
  1300. *    Date/SecToTime()
  1301. *
  1302. ******************************************************************************/
  1303.  
  1304.   {
  1305.    if (tdd != 0)
  1306.     {
  1307.      unsigned short hours,mins,secs;
  1308.      unsigned long hsecs = TimeToSec(this->hours,this->mins,this->secs) / tdd;
  1309.  
  1310.      SecToTime(hsecs,hours,mins,secs);
  1311.      return(timeduration(days,hours,mins,secs));
  1312.     }
  1313.    else
  1314.      return(timeduration(0,0,0,0));
  1315.   }
  1316.  
  1317.  
  1318.  const timeduration &timeduration::operator*=(const unsigned short tdm)
  1319.  
  1320. /****** DateClass/timeduration/operator*=() ***********************************
  1321. *
  1322. *   NAME
  1323. *    operator*=() -- Multiply with operator for timeduration object (V33)
  1324. *
  1325. *   SYNOPSIS
  1326. *    (*this) *= tdm;
  1327. *
  1328. *    const timeduration &operator*=(const unsigned short tdm);
  1329. *
  1330. *   FUNCTION
  1331. *    Muliply the timeduration object with a constant value.
  1332. *
  1333. *   INPUTS
  1334. *    *this - timeduration object
  1335. *    tdm   - Multiplication factor
  1336. *
  1337. *   RESULT
  1338. *    *this - Modified timeduration object
  1339. *
  1340. *   EXAMPLE
  1341. *    ...
  1342. *    td *= 2;
  1343. *    ...
  1344. *
  1345. *   NOTES
  1346. *    None.
  1347. *
  1348. *   BUGS
  1349. *    No known bugs.
  1350. *
  1351. *   SEE ALSO
  1352. *    operator+(),operator-(),operator+=(),operator-=(),operator*(),
  1353. *    operator/(),operator/=(),Date/TimeToSec(),Date/SecToTime()
  1354. *
  1355. ******************************************************************************/
  1356.  
  1357.   {
  1358.    unsigned long hsecs = TimeToSec(this->hours,this->mins,this->secs) * tdm;
  1359.  
  1360.    SecToTime(hsecs,this->hours,this->mins,this->secs);
  1361.    while (this->hours >= 24)
  1362.     {
  1363.      this->hours -= 24;
  1364.      this->days++;
  1365.     }
  1366.    return(*this);
  1367.   }
  1368.  
  1369.  
  1370.  const timeduration &timeduration::operator*=(const unsigned int tdm)
  1371.  
  1372. /****** DateClass/timeduration/operator*=() ***********************************
  1373. *
  1374. *   NAME
  1375. *    operator*=() -- Multiply with operator for timeduration object (V33)
  1376. *
  1377. *   SYNOPSIS
  1378. *    (*this) *= tdm;
  1379. *
  1380. *    const timeduration &operator*=(const unsigned int tdm);
  1381. *
  1382. *   FUNCTION
  1383. *    Muliply the timeduration object with a constant value.
  1384. *
  1385. *   INPUTS
  1386. *    *this - timeduration object
  1387. *    tdm   - Multiplication factor
  1388. *
  1389. *   RESULT
  1390. *    *this - Modified timeduration object
  1391. *
  1392. *   EXAMPLE
  1393. *    ...
  1394. *    td *= 2;
  1395. *    ...
  1396. *
  1397. *   NOTES
  1398. *    None.
  1399. *
  1400. *   BUGS
  1401. *    No known bugs.
  1402. *
  1403. *   SEE ALSO
  1404. *    operator+(),operator-(),operator+=(),operator-=(),operator*(),
  1405. *    operator/(),operator/=(),Date/TimeToSec(),Date/SecToTime()
  1406. *
  1407. ******************************************************************************/
  1408.  
  1409.   {
  1410.    unsigned long hsecs = TimeToSec(this->hours,this->mins,this->secs) * tdm;
  1411.  
  1412.    SecToTime(hsecs,this->hours,this->mins,this->secs);
  1413.    while (this->hours >= 24)
  1414.     {
  1415.      this->hours -= 24;
  1416.      this->days++;
  1417.     }
  1418.    return(*this);
  1419.   }
  1420.  
  1421.  
  1422.  const timeduration &timeduration::operator*=(const unsigned long tdm)
  1423.  
  1424. /****** DateClass/timeduration/operator*=() ***********************************
  1425. *
  1426. *   NAME
  1427. *    operator*=() -- Multiply with operator for timeduration object (V33)
  1428. *
  1429. *   SYNOPSIS
  1430. *    (*this) *= tdm;
  1431. *
  1432. *    const timeduration &operator*=(const unsigned long tdm);
  1433. *
  1434. *   FUNCTION
  1435. *    Muliply the timeduration object with a constant value.
  1436. *
  1437. *   INPUTS
  1438. *    *this - timeduration object
  1439. *    tdm   - Multiplication factor
  1440. *
  1441. *   RESULT
  1442. *    *this - Modified timeduration object
  1443. *
  1444. *   EXAMPLE
  1445. *    ...
  1446. *    td *= 2;
  1447. *    ...
  1448. *
  1449. *   NOTES
  1450. *    None.
  1451. *
  1452. *   BUGS
  1453. *    No known bugs.
  1454. *
  1455. *   SEE ALSO
  1456. *    operator+(),operator-(),operator+=(),operator-=(),operator*(),
  1457. *    operator/(),operator/=(),Date/TimeToSec(),Date/SecToTime()
  1458. *
  1459. ******************************************************************************/
  1460.  
  1461.   {
  1462.    unsigned long hsecs = TimeToSec(this->hours,this->mins,this->secs) * tdm;
  1463.  
  1464.    SecToTime(hsecs,this->hours,this->mins,this->secs);
  1465.    while (this->hours >= 24)
  1466.     {
  1467.      this->hours -= 24;
  1468.      this->days++;
  1469.     }
  1470.    return(*this);
  1471.   }
  1472.  
  1473.  
  1474.  const timeduration &timeduration::operator/=(const unsigned short tdd)
  1475.  
  1476. /****** DateClass/timeduration/operator/=() ***********************************
  1477. *
  1478. *   NAME
  1479. *    operator/=() -- Div through operator for timeduration object (V33)
  1480. *
  1481. *   SYNOPSIS
  1482. *    (*this) /= tdd;
  1483. *
  1484. *    const timeduration &operator/=(const unsigned short tdd);
  1485. *
  1486. *   FUNCTION
  1487. *    Devide the timeduration object by a constant value.
  1488. *    If tdd is 0 you will get back an object with a duration of 0!
  1489. *
  1490. *   INPUTS
  1491. *    *this - timeduration object
  1492. *    tdd   - Division factor
  1493. *
  1494. *   RESULT
  1495. *    *this - Modified timeduration object
  1496. *
  1497. *   EXAMPLE
  1498. *    ...
  1499. *    td /= 2;
  1500. *    ...
  1501. *
  1502. *   NOTES
  1503. *    None.
  1504. *
  1505. *   BUGS
  1506. *    No known bugs.
  1507. *
  1508. *   SEE ALSO
  1509. *    operator+(),operator-(),operator+=(),operator-=(),operator*(),
  1510. *    operator/(),operator*=(),Date/TimeToSec(),Date/SecToTime()
  1511. *
  1512. ******************************************************************************/
  1513.  
  1514.   {
  1515.    if (tdd != 0)
  1516.     {
  1517.      unsigned long hsecs = TimeToSec(this->hours,this->mins,this->secs) / tdd;
  1518.  
  1519.      SecToTime(hsecs,this->hours,this->mins,this->secs);
  1520.     }
  1521.    else
  1522.     {
  1523.      this->days = 0;
  1524.      this->hours = 0;
  1525.      this->mins = 0;
  1526.      this->secs = 0;
  1527.     }
  1528.    return(*this);
  1529.   }
  1530.  
  1531.  
  1532.  const timeduration &timeduration::operator/=(const unsigned int tdd)
  1533.  
  1534. /****** DateClass/timeduration/operator/=() ***********************************
  1535. *
  1536. *   NAME
  1537. *    operator/=() -- Div through operator for timeduration object (V33)
  1538. *
  1539. *   SYNOPSIS
  1540. *    (*this) /= tdd;
  1541. *
  1542. *    const timeduration &operator/=(const unsigned int tdd);
  1543. *
  1544. *   FUNCTION
  1545. *    Devide the timeduration object by a constant value.
  1546. *    If tdd is 0 you will get back an object with a duration of 0!
  1547. *
  1548. *   INPUTS
  1549. *    *this - timeduration object
  1550. *    tdd   - Division factor
  1551. *
  1552. *   RESULT
  1553. *    *this - Modified timeduration object
  1554. *
  1555. *   EXAMPLE
  1556. *    ...
  1557. *    td /= 2;
  1558. *    ...
  1559. *
  1560. *   NOTES
  1561. *    None.
  1562. *
  1563. *   BUGS
  1564. *    No known bugs.
  1565. *
  1566. *   SEE ALSO
  1567. *    operator+(),operator-(),operator+=(),operator-=(),operator*(),
  1568. *    operator/(),operator*=(),Date/TimeToSec(),Date/SecToTime()
  1569. *
  1570. ******************************************************************************/
  1571.  
  1572.   {
  1573.    if (tdd != 0)
  1574.     {
  1575.      unsigned long hsecs = TimeToSec(this->hours,this->mins,this->secs) / tdd;
  1576.  
  1577.      SecToTime(hsecs,this->hours,this->mins,this->secs);
  1578.     }
  1579.    else
  1580.     {
  1581.      this->days = 0;
  1582.      this->hours = 0;
  1583.      this->mins = 0;
  1584.      this->secs = 0;
  1585.     }
  1586.    return(*this);
  1587.   }
  1588.  
  1589.  
  1590.  const timeduration &timeduration::operator/=(const unsigned long tdd)
  1591.  
  1592. /****** DateClass/timeduration/operator/=() ***********************************
  1593. *
  1594. *   NAME
  1595. *    operator/=() -- Div through operator for timeduration object (V33)
  1596. *
  1597. *   SYNOPSIS
  1598. *    (*this) /= tdd;
  1599. *
  1600. *    const timeduration &operator/=(const unsigned long tdd);
  1601. *
  1602. *   FUNCTION
  1603. *    Devide the timeduration object by a constant value.
  1604. *    If tdd is 0 you will get back an object with a duration of 0!
  1605. *
  1606. *   INPUTS
  1607. *    *this - timeduration object
  1608. *    tdd   - Division factor
  1609. *
  1610. *   RESULT
  1611. *    *this - Modified timeduration object
  1612. *
  1613. *   EXAMPLE
  1614. *    ...
  1615. *    td /= 2;
  1616. *    ...
  1617. *
  1618. *   NOTES
  1619. *    None.
  1620. *
  1621. *   BUGS
  1622. *    No known bugs.
  1623. *
  1624. *   SEE ALSO
  1625. *    operator+(),operator-(),operator+=(),operator-=(),operator*(),
  1626. *    operator/(),operator*=(),Date/TimeToSec(),Date/SecToTime()
  1627. *
  1628. ******************************************************************************/
  1629.  
  1630.   {
  1631.    if (tdd != 0)
  1632.     {
  1633.      unsigned long hsecs = TimeToSec(this->hours,this->mins,this->secs) / tdd;
  1634.  
  1635.      SecToTime(hsecs,this->hours,this->mins,this->secs);
  1636.     }
  1637.    else
  1638.     {
  1639.      this->days = 0;
  1640.      this->hours = 0;
  1641.      this->mins = 0;
  1642.      this->secs = 0;
  1643.     }
  1644.    return(*this);
  1645.   }
  1646.  
  1647.  
  1648.  unsigned long timeduration::operator/(const timeduration &td) const
  1649.  
  1650. /****** DateClass/timeduration/operator/() ************************************
  1651. *
  1652. *   NAME
  1653. *    operator/() -- Div operator for timeduration object (V33)
  1654. *
  1655. *   SYNOPSIS
  1656. *    tdf = (*this) / td;
  1657. *
  1658. *    unsigned long operator/(const timeduration &td) const;
  1659. *
  1660. *   FUNCTION
  1661. *    Devide the timeduration object by another timeduration object
  1662. *    to the devision factor.
  1663. *
  1664. *   INPUTS
  1665. *    *this - timeduration object
  1666. *    td    - timeduration object
  1667. *
  1668. *   RESULT
  1669. *    tdf - Devision factor
  1670. *
  1671. *   EXAMPLE
  1672. *    ...
  1673. *    tdf = td1 / td2;
  1674. *    ...
  1675. *
  1676. *   NOTES
  1677. *    None.
  1678. *
  1679. *   BUGS
  1680. *    No known bugs.
  1681. *
  1682. *   SEE ALSO
  1683. *    operator+(),operator-(),operator+=(),operator-=(),operator*(),
  1684. *    operator*=(),operator/=(),operator%(),Date/TimeToSec()
  1685. *
  1686. ******************************************************************************/
  1687.  
  1688.   {
  1689.    if ((*this) >= td)
  1690.      return(TimeToSec(this->hours,this->mins,this->secs) / TimeToSec(td.hours,td.mins,td.secs));
  1691.    else
  1692.      return(TimeToSec(td.hours,td.mins,td.secs) / TimeToSec(this->hours,this->mins,this->secs));
  1693.   }
  1694.  
  1695.  
  1696.  unsigned long timeduration::operator%(const timeduration &td) const
  1697.  
  1698. /****** DateClass/timeduration/operator%() ************************************
  1699. *
  1700. *   NAME
  1701. *    operator%() -- Modulo operator for timeduration object (V33)
  1702. *
  1703. *   SYNOPSIS
  1704. *    tdf = (*this) % td;
  1705. *
  1706. *    unsigned long operator%(const timeduration &td) const;
  1707. *
  1708. *   FUNCTION
  1709. *    Modulo devide the timeduration object by another timeduration object
  1710. *    to the modulo factor.
  1711. *
  1712. *   INPUTS
  1713. *    *this - timeduration object
  1714. *    td    - timeduration object
  1715. *
  1716. *   RESULT
  1717. *    tdf - Modulo factor
  1718. *
  1719. *   EXAMPLE
  1720. *    ...
  1721. *    tdf = td1 % td2;
  1722. *    ...
  1723. *
  1724. *   NOTES
  1725. *    None.
  1726. *
  1727. *   BUGS
  1728. *    No known bugs.
  1729. *
  1730. *   SEE ALSO
  1731. *    operator+(),operator-(),operator+=(),operator-=(),operator*(),
  1732. *    operator/(),operator*=(),operator/=(),Date/TimeToSec()
  1733. *
  1734. ******************************************************************************/
  1735.  
  1736.   {
  1737.    if ((*this) >= td)
  1738.      return(TimeToSec(this->hours,this->mins,this->secs) % TimeToSec(td.hours,td.mins,td.secs));
  1739.    else
  1740.      return(TimeToSec(td.hours,td.mins,td.secs) % TimeToSec(this->hours,this->mins,this->secs));
  1741.   }
  1742.  
  1743.  
  1744.  unsigned short timeduration::gethours(void) const
  1745.  
  1746. /****** DateClass/timeduration/gethours() *************************************
  1747. *
  1748. *   NAME
  1749. *    gethours() -- Get hours of timeduration object (V33)
  1750. *
  1751. *   SYNOPSIS
  1752. *    hours = (*this).gethours();
  1753. *
  1754. *    unsigned short gethours(void) const;
  1755. *
  1756. *   FUNCTION
  1757. *    Gets the number of hours from the timeduration object.
  1758. *
  1759. *   INPUTS
  1760. *    *this - timeduration object
  1761. *
  1762. *   RESULT
  1763. *    hours - Hours of the timeduration object
  1764. *
  1765. *   EXAMPLE
  1766. *    ...
  1767. *    hours = td.gethours();
  1768. *    ...
  1769. *
  1770. *   NOTES
  1771. *    None.
  1772. *
  1773. *   BUGS
  1774. *    No known bugs.
  1775. *
  1776. *   SEE ALSO
  1777. *    getmins(),getsecs(),getinsecs()
  1778. *
  1779. ******************************************************************************/
  1780.  
  1781.   {
  1782.    return(this->hours);
  1783.   }
  1784.  
  1785.  
  1786.  unsigned short timeduration::getmins(void) const
  1787.  
  1788. /****** DateClass/timeduration/getmins() **************************************
  1789. *
  1790. *   NAME
  1791. *    getmins() -- Get mins of timeduration object (V33)
  1792. *
  1793. *   SYNOPSIS
  1794. *    mins = (*this).getmins();
  1795. *
  1796. *    unsigned short getmins(void) const;
  1797. *
  1798. *   FUNCTION
  1799. *    Gets the number of minutes from the timeduration object.
  1800. *
  1801. *   INPUTS
  1802. *    *this - timeduration object
  1803. *
  1804. *   RESULT
  1805. *    mins - Minutes of the timeduration object
  1806. *
  1807. *   EXAMPLE
  1808. *    ...
  1809. *    mins = td.getmins();
  1810. *    ...
  1811. *
  1812. *   NOTES
  1813. *    None.
  1814. *
  1815. *   BUGS
  1816. *    No known bugs.
  1817. *
  1818. *   SEE ALSO
  1819. *    gethours(),getsecs(),getinsecs()
  1820. *
  1821. ******************************************************************************/
  1822.  
  1823.   {
  1824.    return(this->mins);
  1825.   }
  1826.  
  1827.  
  1828.  unsigned short timeduration::getsecs(void) const
  1829.  
  1830. /****** DateClass/timeduration/getsecs() **************************************
  1831. *
  1832. *   NAME
  1833. *    getsecs() -- Get secs of timeduration object (V33)
  1834. *
  1835. *   SYNOPSIS
  1836. *    secs = (*this).getsecs();
  1837. *
  1838. *    unsigned short getsecs(void) const;
  1839. *
  1840. *   FUNCTION
  1841. *    Gets the number of seconds from the timeduration object.
  1842. *
  1843. *   INPUTS
  1844. *    *this - timeduration object
  1845. *
  1846. *   RESULT
  1847. *    secs - Seconds of the timeduration object
  1848. *
  1849. *   EXAMPLE
  1850. *    ...
  1851. *    secs = td.getsecs();
  1852. *    ...
  1853. *
  1854. *   NOTES
  1855. *    None.
  1856. *
  1857. *   BUGS
  1858. *    No known bugs.
  1859. *
  1860. *   SEE ALSO
  1861. *    gethours(),getmins(),getinsecs()
  1862. *
  1863. ******************************************************************************/
  1864.  
  1865.   {
  1866.    return(this->secs);
  1867.   }
  1868.  
  1869.  
  1870.  unsigned long timeduration::getinsecs(void) const
  1871.  
  1872. /****** DateClass/timeduration/getinsecs() ************************************
  1873. *
  1874. *   NAME
  1875. *    getinsecs() -- Get timeduration in secs of timeduration object (V33)
  1876. *
  1877. *   SYNOPSIS
  1878. *    secs = (*this).getinsecs();
  1879. *
  1880. *    unsigned long getinsecs(void) const;
  1881. *
  1882. *   FUNCTION
  1883. *    Gets duration of the timeduration object in seconds.
  1884. *
  1885. *   INPUTS
  1886. *    *this - timeduration object
  1887. *
  1888. *   RESULT
  1889. *    secs - Timeduration of the timeduration object in seconds.
  1890. *
  1891. *   EXAMPLE
  1892. *    ...
  1893. *    secs = td.getinsecs();
  1894. *    ...
  1895. *
  1896. *   NOTES
  1897. *    None.
  1898. *
  1899. *   BUGS
  1900. *    No known bugs.
  1901. *
  1902. *   SEE ALSO
  1903. *    gethours(),getmins(),getsecs(),Date/TimeToSec()
  1904. *
  1905. ******************************************************************************/
  1906.  
  1907.   {
  1908.    return(TimeToSec(this->hours,this->mins,this->secs));
  1909.   }
  1910.  
  1911.  /* --- dateduration ------------------------------------------------------ */
  1912.  
  1913. /****** DateClass/dateduration ************************************************
  1914. *
  1915. *   NAME
  1916. *    dateduration -- Class for date durations (V33)
  1917. *
  1918. *   FUNCTION
  1919. *    This class maps the concept of date durations.
  1920. *
  1921. *   NOTES
  1922. *    None.
  1923. *
  1924. *   BUGS
  1925. *    No known bugs.
  1926. *
  1927. *   SEE ALSO
  1928. *    timeduration,time,date
  1929. *
  1930. ******************************************************************************/
  1931.  
  1932. /****i* DateClass/dateduration/struct dateduration ****************************
  1933. *
  1934. *   NAME
  1935. *    struct dateduration -- Private structure of dateduration class (V33)
  1936. *
  1937. *   SYNOPSIS
  1938. *    struct dateduration {
  1939. *                 unsigned long days;
  1940. *                 unsigned short months,years;
  1941. *                };
  1942. *
  1943. *   FUNCTION
  1944. *    This structure holds the data of a date duration.
  1945. *
  1946. *   ELEMENTS
  1947. *    days   - Number of days in a date duration.
  1948. *    months - Number of months in a date duration.
  1949. *    years  - Number of years in a date duration.
  1950. *
  1951. *   NOTES
  1952. *    None.
  1953. *
  1954. *   BUGS
  1955. *    No known bugs.
  1956. *
  1957. *   SEE ALSO
  1958. *    dateduration(),operator==(),operator!=(),operator<(),operator>(),
  1959. *    operator<=(),operator>=(),operator++(),operator++(int),operator--(),
  1960. *    operator--(int),operator+(),operator-(),operator+=(),operator-=(),
  1961. *    operator*(),operator/(),operator*=(),operator/(),getdays(),getmonths(),
  1962. *    getyears(),getindays(),date
  1963. *
  1964. ******************************************************************************/
  1965.  
  1966.  
  1967.  dateduration::dateduration(unsigned long days, unsigned short months, unsigned short years)
  1968.  
  1969. /****** DateClass/dateduration/dateduration() *********************************
  1970. *
  1971. *   NAME
  1972. *    dateduration() -- Constructor of dateduration class (V33)
  1973. *
  1974. *   SYNOPSIS
  1975. *    dd = dateduration(days=0,months=0,years=0);
  1976. *
  1977. *    dateduration(unsigned long days=0, unsigned short months=0,
  1978. *        unsigned short years=0);
  1979. *
  1980. *   FUNCTION
  1981. *    Constructor of the dateduration class.
  1982. *
  1983. *   INPUTS
  1984. *    days   - Days of a dateduration
  1985. *    months - Months of a dateduration
  1986. *    years  - Years of a dateduration
  1987. *
  1988. *   RESULT
  1989. *    dd - Dateduration object
  1990. *
  1991. *   EXAMPLE
  1992. *    ...
  1993. *    dateduration dd1(14,0,0);
  1994. *    ...
  1995. *
  1996. *   NOTES
  1997. *    None.
  1998. *
  1999. *   BUGS
  2000. *    No known bugs.
  2001. *
  2002. *   SEE ALSO
  2003. *
  2004. *
  2005. ******************************************************************************/
  2006.  
  2007.   {
  2008.    this->days = days;
  2009.    this->months = months;
  2010.    this->years = years;
  2011.   }
  2012.  
  2013.  
  2014.  bool dateduration::operator==(const dateduration &dd) const
  2015.  
  2016. /****** DateClass/dateduration/operator==() ***********************************
  2017. *
  2018. *   NAME
  2019. *    operator==() -- Equal operator for dateduration objects (V33)
  2020. *
  2021. *   SYNOPSIS
  2022. *    compare = ((*this) == dd);
  2023. *
  2024. *    bool operator==(const dateduration &dd) const;
  2025. *
  2026. *   FUNCTION
  2027. *    Compares two dateduration objects for equality.
  2028. *
  2029. *   INPUTS
  2030. *    *this - dateduration object
  2031. *    dd    - dateduration object
  2032. *
  2033. *   RESULT
  2034. *    compare - Boolean result of the equal compare operation
  2035. *
  2036. *   EXAMPLE
  2037. *    ...
  2038. *    if (dd1 == dd2)
  2039. *      printf("==\n");
  2040. *    else
  2041. *      printf("!=\n");
  2042. *    ...
  2043. *
  2044. *   NOTES
  2045. *    None.
  2046. *
  2047. *   BUGS
  2048. *    No known bugs.
  2049. *
  2050. *   SEE ALSO
  2051. *    operator!=(),operator<(),operator>(),operator<=(),operator>=()
  2052. *
  2053. ******************************************************************************/
  2054.  
  2055.   {
  2056.    return((this->days == dd.days) && (this->months == dd.months) && (this->years == dd.years));
  2057.   }
  2058.  
  2059.  
  2060.  bool dateduration::operator!=(const dateduration &dd) const
  2061.  
  2062. /****** DateClass/dateduration/operator!=() ***********************************
  2063. *
  2064. *   NAME
  2065. *    operator!=() -- Unequal operator for dateduration objects (V33)
  2066. *
  2067. *   SYNOPSIS
  2068. *    compare = ((*this) != dd);
  2069. *
  2070. *    bool operator!=(const dateduration &dd) const;
  2071. *
  2072. *   FUNCTION
  2073. *    Compares two dateduration objects for unequality.
  2074. *
  2075. *   INPUTS
  2076. *    *this - dateduration object
  2077. *    dd    - dateduration object
  2078. *
  2079. *   RESULT
  2080. *    compare - Boolean result of the unequal compare operation
  2081. *
  2082. *   EXAMPLE
  2083. *    ...
  2084. *    if (dd1 != dd2)
  2085. *      printf("!=\n");
  2086. *    else
  2087. *      printf("==\n");
  2088. *    ...
  2089. *
  2090. *   NOTES
  2091. *    None.
  2092. *
  2093. *   BUGS
  2094. *    No known bugs.
  2095. *
  2096. *   SEE ALSO
  2097. *    operator==(),operator<(),operator>(),operator<=(),operator>=()
  2098. *
  2099. ******************************************************************************/
  2100.  
  2101.   {
  2102.    return((this->days != dd.days) || (this->months != dd.months) || (this->years != dd.years));
  2103.   }
  2104.  
  2105.  
  2106.  bool dateduration::operator< (const dateduration &dd) const
  2107.  
  2108. /****** DateClass/dateeduration/operator<() ***********************************
  2109. *
  2110. *   NAME
  2111. *    operator<() -- Lower than operator for dateduration objects (V33)
  2112. *
  2113. *   SYNOPSIS
  2114. *    compare = ((*this) < dd);
  2115. *
  2116. *    bool operator<(const dateduration &dd) const;
  2117. *
  2118. *   FUNCTION
  2119. *    Compares if dateduration object 1 is lower than dateduration object 2.
  2120. *
  2121. *   INPUTS
  2122. *    *this - dateduration object
  2123. *    dd    - dateduration object
  2124. *
  2125. *   RESULT
  2126. *    compare - Boolean result of the lower than compare operation
  2127. *
  2128. *   EXAMPLE
  2129. *    ...
  2130. *    if (dd1 < dd2)
  2131. *      printf("<\n");
  2132. *    else
  2133. *      printf(">=\n");
  2134. *    ...
  2135. *
  2136. *   NOTES
  2137. *    A month will be calculated as 30 days, a year as 365 days.
  2138. *
  2139. *   BUGS
  2140. *    No known bugs.
  2141. *
  2142. *   SEE ALSO
  2143. *    operator==(),operator!=(),operator>(),operator<=(),operator>=()
  2144. *
  2145. ******************************************************************************/
  2146.  
  2147.   {
  2148.    return((this->days + this->months*30 + this->years*365) < (dd.days + dd.months*30 + dd.years*365));
  2149.   }
  2150.  
  2151.  
  2152.  bool dateduration::operator> (const dateduration &dd) const
  2153.  
  2154. /****** DateClass/dateduration/operator>() ************************************
  2155. *
  2156. *   NAME
  2157. *    operator>() -- Greater than operator for dateduration objects (V33)
  2158. *
  2159. *   SYNOPSIS
  2160. *    compare = ((*this) > dd);
  2161. *
  2162. *    bool operator>(const dateduration &dd) const;
  2163. *
  2164. *   FUNCTION
  2165. *    Compares if dateduration object 1 is greater than dateduration
  2166. *    object 2.
  2167. *
  2168. *   INPUTS
  2169. *    *this - dateduration object
  2170. *    dd    - dateduration object
  2171. *
  2172. *   RESULT
  2173. *    compare - Boolean result of the greater than compare operation
  2174. *
  2175. *   EXAMPLE
  2176. *    ...
  2177. *    if (dd1 > dd2)
  2178. *      printf(">\n");
  2179. *    else
  2180. *      printf("<=\n");
  2181. *    ...
  2182. *
  2183. *   NOTES
  2184. *    A month will be calculated as 30 days, a year as 365 days.
  2185. *
  2186. *   BUGS
  2187. *    No known bugs.
  2188. *
  2189. *   SEE ALSO
  2190. *    operator==(),operator!=(),operator<(),operator<=(),operator>=()
  2191. *
  2192. ******************************************************************************/
  2193.  
  2194.   {
  2195.    return((this->days + this->months*30 + this->years*365) > (dd.days + dd.months*30 + dd.years*365));
  2196.   }
  2197.  
  2198.  
  2199.  bool dateduration::operator<=(const dateduration &dd) const
  2200.  
  2201. /****** DateClass/dateduration/operator<=() ***********************************
  2202. *
  2203. *   NAME
  2204. *    operator<=() -- Lower or equal operator for dateduration objects (V33)
  2205. *
  2206. *   SYNOPSIS
  2207. *    compare = ((*this) <= dd);
  2208. *
  2209. *    bool operator<=(const dateduration &dd) const;
  2210. *
  2211. *   FUNCTION
  2212. *    Compares if dateduration object 1 is lower or equal than dateduration
  2213. *    object 2.
  2214. *
  2215. *   INPUTS
  2216. *    *this - dateduration object
  2217. *    dd    - dateduration object
  2218. *
  2219. *   RESULT
  2220. *    compare - Boolean result of the lower or equal compare operation
  2221. *
  2222. *   EXAMPLE
  2223. *    ...
  2224. *    if (dd1 <= dd2)
  2225. *      printf("<=\n");
  2226. *    else
  2227. *      printf(">\n");
  2228. *    ...
  2229. *
  2230. *   NOTES
  2231. *    A month will be calculated as 30 days, a year as 365 days.
  2232. *
  2233. *   BUGS
  2234. *    No known bugs.
  2235. *
  2236. *   SEE ALSO
  2237. *    operator==(),operator!=(),operator<(),operator>(),operator>=()
  2238. *
  2239. ******************************************************************************/
  2240.  
  2241.   {
  2242.    return((this->days + this->months*30 + this->years*365) <= (dd.days + dd.months*30 + dd.years*365));
  2243.   }
  2244.  
  2245.  
  2246.  bool dateduration::operator>=(const dateduration &dd) const
  2247.  
  2248. /****** DateClass/dateduration/operator>=() ***********************************
  2249. *
  2250. *   NAME
  2251. *    operator>=() -- Greater or equal operator for dateduration objs (V33)
  2252. *
  2253. *   SYNOPSIS
  2254. *    compare = ((*this) >= dd);
  2255. *
  2256. *    bool operator>=(const dateduration &dd) const;
  2257. *
  2258. *   FUNCTION
  2259. *    Compares if dateduration object 1 is greater or equal than dateduration
  2260. *    object 2.
  2261. *
  2262. *   INPUTS
  2263. *    *this - dateduration object
  2264. *    dd    - dateduration object
  2265. *
  2266. *   RESULT
  2267. *    compare - Boolean result of the greater or equal compare operation
  2268. *
  2269. *   EXAMPLE
  2270. *    ...
  2271. *    if (dd1 >= dd2)
  2272. *      printf(">=\n");
  2273. *    else
  2274. *      printf("<\n");
  2275. *    ...
  2276. *
  2277. *   NOTES
  2278. *    A month will be calculated as 30 days, a year as 365 days.
  2279. *
  2280. *   BUGS
  2281. *    No known bugs.
  2282. *
  2283. *   SEE ALSO
  2284. *    operator==(),operator!=(),operator<(),operator>(),operator<=()
  2285. *
  2286. ******************************************************************************/
  2287.  
  2288.   {
  2289.    return((this->days + this->months*30 + this->years*365) >= (dd.days + dd.months*30 + dd.years*365));
  2290.   }
  2291.  
  2292.  
  2293.  dateduration dateduration::operator++()
  2294.  
  2295. /****** DateClass/dateduration/operator++() ***********************************
  2296. *
  2297. *   NAME
  2298. *    operator++() -- Increment operator for dateduration object (V33)
  2299. *
  2300. *   SYNOPSIS
  2301. *    dd++;
  2302. *
  2303. *    dateduration operator++();
  2304. *
  2305. *   FUNCTION
  2306. *    Increments the dateduration object by one day.
  2307. *
  2308. *   INPUTS
  2309. *    *this - dateduration object
  2310. *
  2311. *   RESULT
  2312. *    *this - modified dateduration object
  2313. *
  2314. *   EXAMPLE
  2315. *    ...
  2316. *    dd++;
  2317. *    ...
  2318. *
  2319. *   NOTES
  2320. *    None.
  2321. *
  2322. *   BUGS
  2323. *    No known bugs.
  2324. *
  2325. *   SEE ALSO
  2326. *    operator++(int),operator--(),operator--(int)
  2327. *
  2328. ******************************************************************************/
  2329.  
  2330.   {
  2331.    dateduration tmp = *this;
  2332.  
  2333.    this->days++;
  2334.    return(tmp);
  2335.   }
  2336.  
  2337.  
  2338.  dateduration dateduration::operator++(int)
  2339.  
  2340. /****** DateClass/dateduration/operator++(int) ********************************
  2341. *
  2342. *   NAME
  2343. *    operator++() -- Increment operator for dateduration object (V33)
  2344. *
  2345. *   SYNOPSIS
  2346. *    ++dd;
  2347. *
  2348. *    dateduration operator++(int);
  2349. *
  2350. *   FUNCTION
  2351. *    Increments the dateduration object by one day.
  2352. *
  2353. *   INPUTS
  2354. *    *this - dateduration object
  2355. *
  2356. *   RESULT
  2357. *    *this - modified dateduration object
  2358. *
  2359. *   EXAMPLE
  2360. *    ...
  2361. *    ++dd;
  2362. *    ...
  2363. *
  2364. *   NOTES
  2365. *    None.
  2366. *
  2367. *   BUGS
  2368. *    No known bugs.
  2369. *
  2370. *   SEE ALSO
  2371. *    operator++(),operator--(),operator--(int)
  2372. *
  2373. ******************************************************************************/
  2374.  
  2375.   {
  2376.    this->days++;
  2377.    return(*this);
  2378.   }
  2379.  
  2380.  
  2381.  dateduration dateduration::operator--()
  2382.  
  2383. /****** DateClass/dateduration/operator--() ***********************************
  2384. *
  2385. *   NAME
  2386. *    operator--() -- Decrement operator for dateduration object (V33)
  2387. *
  2388. *   SYNOPSIS
  2389. *    dd--;
  2390. *
  2391. *    dateduration operator--();
  2392. *
  2393. *   FUNCTION
  2394. *    Decrements the dateduration object by one day.
  2395. *
  2396. *   INPUTS
  2397. *    *this - dateduration object
  2398. *
  2399. *   RESULT
  2400. *    *this - modified dateduration object
  2401. *
  2402. *   EXAMPLE
  2403. *    ...
  2404. *    dd--;
  2405. *    ...
  2406. *
  2407. *   NOTES
  2408. *    None.
  2409. *
  2410. *   BUGS
  2411. *    No known bugs.
  2412. *
  2413. *   SEE ALSO
  2414. *    operator++(),operator++(int),operator--(int)
  2415. *
  2416. ******************************************************************************/
  2417.  
  2418.   {
  2419.    dateduration tmp = *this;
  2420.  
  2421.    if (this->days > 0)
  2422.      this->days--;
  2423.    return(tmp);
  2424.   }
  2425.  
  2426.  
  2427.  dateduration dateduration::operator--(int)
  2428.  
  2429. /****** DateClass/dateduration/operator--(int) ********************************
  2430. *
  2431. *   NAME
  2432. *    operator--() -- Decrement operator for dateduration object (V33)
  2433. *
  2434. *   SYNOPSIS
  2435. *    --dd;
  2436. *
  2437. *    dateduration operator--(int);
  2438. *
  2439. *   FUNCTION
  2440. *    Decrements the dateduration object by one day.
  2441. *
  2442. *   INPUTS
  2443. *    *this - dateduration object
  2444. *
  2445. *   RESULT
  2446. *    *this - modified dateduration object
  2447. *
  2448. *   EXAMPLE
  2449. *    ...
  2450. *    --dd;
  2451. *    ...
  2452. *
  2453. *   NOTES
  2454. *    None.
  2455. *
  2456. *   BUGS
  2457. *    No known bugs.
  2458. *
  2459. *   SEE ALSO
  2460. *    operator++(),operator++(int),operator--()
  2461. *
  2462. ******************************************************************************/
  2463.  
  2464.   {
  2465.    if (this->days > 0)
  2466.      this->days--;
  2467.    return(*this);
  2468.   }
  2469.  
  2470.  
  2471.  dateduration dateduration::operator+(const dateduration &dd) const
  2472.  
  2473. /****** DateClass/dateduration/operator+() ************************************
  2474. *
  2475. *   NAME
  2476. *    operator+() -- Add operator for dateduration objects (V33)
  2477. *
  2478. *   SYNOPSIS
  2479. *    ddres = (*this) + dd;
  2480. *
  2481. *    dateduration operator+(const dateduration &dd) const;
  2482. *
  2483. *   FUNCTION
  2484. *    Add two dateduration objects to a new dateduration object.
  2485. *
  2486. *   INPUTS
  2487. *    *this - dateduration object
  2488. *    dd    - dateduration object
  2489. *
  2490. *   RESULT
  2491. *    ddres - new dateduration object
  2492. *
  2493. *   EXAMPLE
  2494. *    ...
  2495. *    ddres = dd1 + dd2;
  2496. *    ...
  2497. *
  2498. *   NOTES
  2499. *    None.
  2500. *
  2501. *   BUGS
  2502. *    No known bugs.
  2503. *
  2504. *   SEE ALSO
  2505. *    operator-(),operator+=(),operator-=(),operator*(),operator/(),
  2506. *    operator*=(),operator/=(),dateduration()
  2507. *
  2508. ******************************************************************************/
  2509.  
  2510.   {
  2511.    return(dateduration(this->days+dd.days,this->months+dd.months,this->years+dd.years));
  2512.   }
  2513.  
  2514.  
  2515.  dateduration dateduration::operator-(const dateduration &dd) const
  2516.  
  2517. /****** DateClass/dateduration/operator-() ************************************
  2518. *
  2519. *   NAME
  2520. *    operator-() -- Sub operator for dateduration objects (V33)
  2521. *
  2522. *   SYNOPSIS
  2523. *    ddres = (*this) - dd;
  2524. *
  2525. *    dateduration operator-(const dateduration &dd) const;
  2526. *
  2527. *   FUNCTION
  2528. *    Subtract dateduration object 2 from dateduration object 1 to a new
  2529. *    dateduration object.
  2530. *    If object 2 is greater than object 1 you get back an object with a
  2531. *    duration of 0!
  2532. *
  2533. *   INPUTS
  2534. *    *this - dateduration object
  2535. *    dd    - dateduration object
  2536. *
  2537. *   RESULT
  2538. *    ddres - new dateduration object
  2539. *
  2540. *   EXAMPLE
  2541. *    ...
  2542. *    ddres = dd1 - dd2;
  2543. *    ...
  2544. *
  2545. *   NOTES
  2546. *    None.
  2547. *
  2548. *   BUGS
  2549. *    No known bugs.
  2550. *
  2551. *   SEE ALSO
  2552. *    operator+(),operator+=(),operator-=(),operator*(),operator/(),
  2553. *    operator*=(),operator/=(),dateduration()
  2554. *
  2555. ******************************************************************************/
  2556.  
  2557.   {
  2558.    if ((this->days < dd.days) || (this->months < dd.months) || (this->years < dd.years))
  2559.      return(dateduration(0,0,0));
  2560.    else
  2561.      return(dateduration(this->days-dd.days,this->months-dd.months,this->years-dd.years));
  2562.   }
  2563.  
  2564.  
  2565.  const dateduration &dateduration::operator+=(const dateduration &dd)
  2566.  
  2567. /****** DateClass/dateduration/operator+=() ***********************************
  2568. *
  2569. *   NAME
  2570. *    operator+=() -- Add to operator for dateduration objects (V33)
  2571. *
  2572. *   SYNOPSIS
  2573. *    (*this) += dd;
  2574. *
  2575. *    const dateduration &operator+=(const dateduration &dd);
  2576. *
  2577. *   FUNCTION
  2578. *    Add dateduration object 2 to dateduration object 1.
  2579. *
  2580. *   INPUTS
  2581. *    *this - dateduration object
  2582. *    dd    - dateduration object
  2583. *
  2584. *   RESULT
  2585. *    *this - modified dateduration object
  2586. *
  2587. *   EXAMPLE
  2588. *    ...
  2589. *    dd1 += dd2;
  2590. *    ...
  2591. *
  2592. *   NOTES
  2593. *    None.
  2594. *
  2595. *   BUGS
  2596. *    No known bugs.
  2597. *
  2598. *   SEE ALSO
  2599. *    operator+(),operator-(),operator-=(),operator*(),operator/(),
  2600. *    operator*=(),operator/=()
  2601. *
  2602. ******************************************************************************/
  2603.  
  2604.   {
  2605.    this->days += dd.days;
  2606.    this->months += dd.months;
  2607.    this->years += dd.years;
  2608.    return(*this);
  2609.   }
  2610.  
  2611.  
  2612.  const dateduration &dateduration::operator-=(const dateduration &dd)
  2613.  
  2614. /****** DateClass/dateduration/operator-=() ***********************************
  2615. *
  2616. *   NAME
  2617. *    operator-=() -- Sub from operator for dateduration objects (V33)
  2618. *
  2619. *   SYNOPSIS
  2620. *    (*this) -= dd;
  2621. *
  2622. *    const dateduration &operator-=(const dateduration &dd);
  2623. *
  2624. *   FUNCTION
  2625. *    Subtract dateduration object 2 from dateduration object 1.
  2626. *    If object 2 is greater than object 1 you get back an object with a
  2627. *    duration of 0!
  2628. *
  2629. *   INPUTS
  2630. *    *this - dateduration object
  2631. *    dd    - dateduration object
  2632. *
  2633. *   RESULT
  2634. *    *this - modified dateduration object
  2635. *
  2636. *   EXAMPLE
  2637. *    ...
  2638. *    dd1 -= dd2;
  2639. *    ...
  2640. *
  2641. *   NOTES
  2642. *    None.
  2643. *
  2644. *   BUGS
  2645. *    No known bugs.
  2646. *
  2647. *   SEE ALSO
  2648. *    operator+(),operator-(),operator+=(),operator*(),operator/(),
  2649. *    operator*=(),operator/=()
  2650. *
  2651. ******************************************************************************/
  2652.  
  2653.   {
  2654.    if ((this->days < dd.days) || (this->months < dd.months) || (this->years < dd.years))
  2655.     {
  2656.      this->days = 0;
  2657.      this->months = 0;
  2658.      this->years = 0;
  2659.     }
  2660.    else
  2661.     {
  2662.      this->days -= dd.days;
  2663.      this->months -= dd.months;
  2664.      this->years -= dd.years;
  2665.     }
  2666.    return(*this);
  2667.   }
  2668.  
  2669.  
  2670.  dateduration dateduration::operator*(const unsigned short ddm) const
  2671.  
  2672. /****** DateClass/dateduration/operator*() ************************************
  2673. *
  2674. *   NAME
  2675. *    operator*() -- Multiply operator for dateduration object (V33)
  2676. *
  2677. *   SYNOPSIS
  2678. *    ddres = (*this) * ddm;
  2679. *
  2680. *    dateduration operator*(const unsigned short ddm) const;
  2681. *
  2682. *   FUNCTION
  2683. *    Muliply the dateduration object with a constant value to a new
  2684. *    dateduration object.
  2685. *
  2686. *   INPUTS
  2687. *    *this - dateduration object
  2688. *    ddm   - Multiplication factor
  2689. *
  2690. *   RESULT
  2691. *    ddres - New dateduration object
  2692. *
  2693. *   EXAMPLE
  2694. *    ...
  2695. *    ddres = dd * 2;
  2696. *    ...
  2697. *
  2698. *   NOTES
  2699. *    None.
  2700. *
  2701. *   BUGS
  2702. *    No known bugs.
  2703. *
  2704. *   SEE ALSO
  2705. *    operator+(),operator-(),operator+=(),operator-=(),operator/(),
  2706. *    operator*=(),operator/=(),dateduration()
  2707. *
  2708. ******************************************************************************/
  2709.  
  2710.   {
  2711.    return(dateduration(this->days*ddm,this->months*ddm,this->years*ddm));
  2712.   }
  2713.  
  2714.  
  2715.  dateduration dateduration::operator*(const unsigned int ddm) const
  2716.  
  2717. /****** DateClass/dateduration/operator*() ************************************
  2718. *
  2719. *   NAME
  2720. *    operator*() -- Multiply operator for dateduration object (V33)
  2721. *
  2722. *   SYNOPSIS
  2723. *    ddres = (*this) * ddm;
  2724. *
  2725. *    dateduration operator*(const unsigned int ddm) const;
  2726. *
  2727. *   FUNCTION
  2728. *    Muliply the dateduration object with a constant value to a new
  2729. *    dateduration object.
  2730. *
  2731. *   INPUTS
  2732. *    *this - dateduration object
  2733. *    ddm   - Multiplication factor
  2734. *
  2735. *   RESULT
  2736. *    ddres - New dateduration object
  2737. *
  2738. *   EXAMPLE
  2739. *    ...
  2740. *    ddres = dd * 2;
  2741. *    ...
  2742. *
  2743. *   NOTES
  2744. *    None.
  2745. *
  2746. *   BUGS
  2747. *    No known bugs.
  2748. *
  2749. *   SEE ALSO
  2750. *    operator+(),operator-(),operator+=(),operator-=(),operator/(),
  2751. *    operator*=(),operator/=(),dateduration()
  2752. *
  2753. ******************************************************************************/
  2754.  
  2755.   {
  2756.    return(dateduration(this->days*ddm,this->months*ddm,this->years*ddm));
  2757.   }
  2758.  
  2759.  
  2760.  dateduration dateduration::operator*(const unsigned long ddm) const
  2761.  
  2762. /****** DateClass/dateduration/operator*() ************************************
  2763. *
  2764. *   NAME
  2765. *    operator*() -- Multiply operator for dateduration object (V33)
  2766. *
  2767. *   SYNOPSIS
  2768. *    ddres = (*this) * ddm;
  2769. *
  2770. *    dateduration operator*(const unsigned long ddm) const;
  2771. *
  2772. *   FUNCTION
  2773. *    Muliply the dateduration object with a constant value to a new
  2774. *    dateduration object.
  2775. *
  2776. *   INPUTS
  2777. *    *this - dateduration object
  2778. *    ddm   - Multiplication factor
  2779. *
  2780. *   RESULT
  2781. *    ddres - New dateduration object
  2782. *
  2783. *   EXAMPLE
  2784. *    ...
  2785. *    ddres = dd * 2;
  2786. *    ...
  2787. *
  2788. *   NOTES
  2789. *    None.
  2790. *
  2791. *   BUGS
  2792. *    No known bugs.
  2793. *
  2794. *   SEE ALSO
  2795. *    operator+(),operator-(),operator+=(),operator-=(),operator/(),
  2796. *    operator*=(),operator/=(),dateduration()
  2797. *
  2798. ******************************************************************************/
  2799.  
  2800.   {
  2801.    return(dateduration(this->days*ddm,(short)(this->months*ddm),(short)(this->years*ddm)));
  2802.   }
  2803.  
  2804.  
  2805.  dateduration dateduration::operator/(const unsigned short ddd) const
  2806.  
  2807. /****** DateClass/dateduration/operator/() ************************************
  2808. *
  2809. *   NAME
  2810. *    operator/() -- Div operator for dateduration object (V33)
  2811. *
  2812. *   SYNOPSIS
  2813. *    ddres = (*this) / ddd;
  2814. *
  2815. *    dateduration operator/(const unsigned short ddd) const;
  2816. *
  2817. *   FUNCTION
  2818. *    Devide the dateduration object by a constant value to a new
  2819. *    dateduration object.
  2820. *    If ddd is 0 you will get back an object with a duration of 0!
  2821. *
  2822. *   INPUTS
  2823. *    *this - dateduration object
  2824. *    ddd   - Division factor
  2825. *
  2826. *   RESULT
  2827. *    ddres - New dateduration object
  2828. *
  2829. *   EXAMPLE
  2830. *    ...
  2831. *    ddres = dd / 2;
  2832. *    ...
  2833. *
  2834. *   NOTES
  2835. *    None.
  2836. *
  2837. *   BUGS
  2838. *    No known bugs.
  2839. *
  2840. *   SEE ALSO
  2841. *    operator+(),operator-(),operator+=(),operator-=(),operator*(),
  2842. *    operator*=(),operator/=(),dateduration()
  2843. *
  2844. ******************************************************************************/
  2845.  
  2846.   {
  2847.    if (ddd != 0)
  2848.      return(dateduration(this->days/ddd,this->months/ddd,this->years/ddd));
  2849.    else
  2850.      return(dateduration(0,0,0));
  2851.   }
  2852.  
  2853.  
  2854.  dateduration dateduration::operator/(const unsigned int ddd) const
  2855.  
  2856. /****** DateClass/dateduration/operator/() ************************************
  2857. *
  2858. *   NAME
  2859. *    operator/() -- Div operator for dateduration object (V33)
  2860. *
  2861. *   SYNOPSIS
  2862. *    ddres = (*this) / ddd;
  2863. *
  2864. *    dateduration operator/(const unsigned int ddd) const;
  2865. *
  2866. *   FUNCTION
  2867. *    Devide the dateduration object by a constant value to a new
  2868. *    dateduration object.
  2869. *    If ddd is 0 you will get back an object with a duration of 0!
  2870. *
  2871. *   INPUTS
  2872. *    *this - dateduration object
  2873. *    ddd   - Division factor
  2874. *
  2875. *   RESULT
  2876. *    ddres - New dateduration object
  2877. *
  2878. *   EXAMPLE
  2879. *    ...
  2880. *    ddres = dd / 2;
  2881. *    ...
  2882. *
  2883. *   NOTES
  2884. *    None.
  2885. *
  2886. *   BUGS
  2887. *    No known bugs.
  2888. *
  2889. *   SEE ALSO
  2890. *    operator+(),operator-(),operator+=(),operator-=(),operator*(),
  2891. *    operator*=(),operator/=(),dateduration()
  2892. *
  2893. ******************************************************************************/
  2894.  
  2895.   {
  2896.    if (ddd != 0)
  2897.      return(dateduration(this->days/ddd,this->months/ddd,this->years/ddd));
  2898.    else
  2899.      return(dateduration(0,0,0));
  2900.   }
  2901.  
  2902.  
  2903.  dateduration dateduration::operator/(const unsigned long ddd) const
  2904.  
  2905. /****** DateClass/dateduration/operator/() ************************************
  2906. *
  2907. *   NAME
  2908. *    operator/() -- Div operator for dateduration object (V33)
  2909. *
  2910. *   SYNOPSIS
  2911. *    ddres = (*this) / ddd;
  2912. *
  2913. *    dateduration operator/(const unsigned long ddd) const;
  2914. *
  2915. *   FUNCTION
  2916. *    Devide the dateduration object by a constant value to a new
  2917. *    dateduration object.
  2918. *    If ddd is 0 you will get back an object with a duration of 0!
  2919. *
  2920. *   INPUTS
  2921. *    *this - dateduration object
  2922. *    ddd   - Division factor
  2923. *
  2924. *   RESULT
  2925. *    ddres - New dateduration object
  2926. *
  2927. *   EXAMPLE
  2928. *    ...
  2929. *    ddres = dd / 2;
  2930. *    ...
  2931. *
  2932. *   NOTES
  2933. *    None.
  2934. *
  2935. *   BUGS
  2936. *    No known bugs.
  2937. *
  2938. *   SEE ALSO
  2939. *    operator+(),operator-(),operator+=(),operator-=(),operator*(),
  2940. *    operator*=(),operator/=(),dateduration()
  2941. *
  2942. ******************************************************************************/
  2943.  
  2944.   {
  2945.    if (ddd != 0)
  2946.      return(dateduration(this->days/ddd,(short)(this->months/ddd),(short)(this->years/ddd)));
  2947.    else
  2948.      return(dateduration(0,0,0));
  2949.   }
  2950.  
  2951.  
  2952.  const dateduration &dateduration::operator*=(const unsigned short ddm)
  2953.  
  2954. /****** DateClass/dateduration/operator*=() ***********************************
  2955. *
  2956. *   NAME
  2957. *    operator*=() -- Multiply with operator for dateduration object (V33)
  2958. *
  2959. *   SYNOPSIS
  2960. *    (*this) *= ddm;
  2961. *
  2962. *    const dateduration &operator*=(const unsigned short ddm);
  2963. *
  2964. *   FUNCTION
  2965. *    Muliply the dateduration object with a constant value.
  2966. *
  2967. *   INPUTS
  2968. *    *this - dateduration object
  2969. *    ddm   - Multiplication factor
  2970. *
  2971. *   RESULT
  2972. *    *this - Modified dateduration object
  2973. *
  2974. *   EXAMPLE
  2975. *    ...
  2976. *    dd *= 2;
  2977. *    ...
  2978. *
  2979. *   NOTES
  2980. *    None.
  2981. *
  2982. *   BUGS
  2983. *    No known bugs.
  2984. *
  2985. *   SEE ALSO
  2986. *    operator+(),operator-(),operator+=(),operator-=(),operator*(),
  2987. *    operator/(),operator/=()
  2988. *
  2989. ******************************************************************************/
  2990.  
  2991.   {
  2992.    this->days *= ddm;
  2993.    this->months *= ddm;
  2994.    this->years *= ddm;
  2995.    return(*this);
  2996.   }
  2997.  
  2998.  
  2999.  const dateduration &dateduration::operator*=(const unsigned int ddm)
  3000.  
  3001. /****** DateClass/dateduration/operator*=() ***********************************
  3002. *
  3003. *   NAME
  3004. *    operator*=() -- Multiply with operator for dateduration object (V33)
  3005. *
  3006. *   SYNOPSIS
  3007. *    (*this) *= ddm;
  3008. *
  3009. *    const dateduration &operator*=(const unsigned int ddm);
  3010. *
  3011. *   FUNCTION
  3012. *    Muliply the dateduration object with a constant value.
  3013. *
  3014. *   INPUTS
  3015. *    *this - dateduration object
  3016. *    ddm   - Multiplication factor
  3017. *
  3018. *   RESULT
  3019. *    *this - Modified dateduration object
  3020. *
  3021. *   EXAMPLE
  3022. *    ...
  3023. *    dd *= 2;
  3024. *    ...
  3025. *
  3026. *   NOTES
  3027. *    None.
  3028. *
  3029. *   BUGS
  3030. *    No known bugs.
  3031. *
  3032. *   SEE ALSO
  3033. *    operator+(),operator-(),operator+=(),operator-=(),operator*(),
  3034. *    operator/(),operator/=()
  3035. *
  3036. ******************************************************************************/
  3037.  
  3038.   {
  3039.    this->days *= ddm;
  3040.    this->months *= ddm;
  3041.    this->years *= ddm;
  3042.    return(*this);
  3043.   }
  3044.  
  3045.  
  3046.  const dateduration &dateduration::operator*=(const unsigned long ddm)
  3047.  
  3048. /****** DateClass/dateduration/operator*=() ***********************************
  3049. *
  3050. *   NAME
  3051. *    operator*=() -- Multiply with operator for dateduration object (V33)
  3052. *
  3053. *   SYNOPSIS
  3054. *    (*this) *= ddm;
  3055. *
  3056. *    const dateduration &operator*=(const unsigned long ddm);
  3057. *
  3058. *   FUNCTION
  3059. *    Muliply the dateduration object with a constant value.
  3060. *
  3061. *   INPUTS
  3062. *    *this - dateduration object
  3063. *    ddm   - Multiplication factor
  3064. *
  3065. *   RESULT
  3066. *    *this - Modified dateduration object
  3067. *
  3068. *   EXAMPLE
  3069. *    ...
  3070. *    dd *= 2;
  3071. *    ...
  3072. *
  3073. *   NOTES
  3074. *    None.
  3075. *
  3076. *   BUGS
  3077. *    No known bugs.
  3078. *
  3079. *   SEE ALSO
  3080. *    operator+(),operator-(),operator+=(),operator-=(),operator*(),
  3081. *    operator/(),operator/=()
  3082. *
  3083. ******************************************************************************/
  3084.  
  3085.   {
  3086.    this->days *= ddm;
  3087.    this->months *= (int)ddm;
  3088.    this->years *= (int)ddm;
  3089.    return(*this);
  3090.   }
  3091.  
  3092.  
  3093.  const dateduration &dateduration::operator/=(const unsigned short ddd)
  3094.  
  3095. /****** DateClass/dateduration/operator/=() ***********************************
  3096. *
  3097. *   NAME
  3098. *    operator/=() -- Div through operator for dateduration object (V33)
  3099. *
  3100. *   SYNOPSIS
  3101. *    (*this) /= ddd;
  3102. *
  3103. *    const dateduration &operator/=(const unsigned short ddd);
  3104. *
  3105. *   FUNCTION
  3106. *    Devide the dateduration object by a constant value.
  3107. *    If ddd is 0 you will get back an object with a duration of 0!
  3108. *
  3109. *   INPUTS
  3110. *    *this - dateduration object
  3111. *    ddd   - Division factor
  3112. *
  3113. *   RESULT
  3114. *    *this - Modified dateduration object
  3115. *
  3116. *   EXAMPLE
  3117. *    ...
  3118. *    dd /= 2;
  3119. *    ...
  3120. *
  3121. *   NOTES
  3122. *    None.
  3123. *
  3124. *   BUGS
  3125. *    No known bugs.
  3126. *
  3127. *   SEE ALSO
  3128. *    operator+(),operator-(),operator+=(),operator-=(),operator*(),
  3129. *    operator/(),operator*=()
  3130. *
  3131. ******************************************************************************/
  3132.  
  3133.   {
  3134.    if (ddd != 0)
  3135.     {
  3136.      this->days /= ddd;
  3137.      this->months /= ddd;
  3138.      this->years /= ddd;
  3139.     }
  3140.    else
  3141.     {
  3142.      this->days = 0;
  3143.      this->months = 0;
  3144.      this->years = 0;
  3145.     }
  3146.    return(*this);
  3147.   }
  3148.  
  3149.  
  3150.  const dateduration &dateduration::operator/=(const unsigned int ddd)
  3151.  
  3152. /****** DateClass/dateduration/operator/=() ***********************************
  3153. *
  3154. *   NAME
  3155. *    operator/=() -- Div through operator for dateduration object (V33)
  3156. *
  3157. *   SYNOPSIS
  3158. *    (*this) /= ddd;
  3159. *
  3160. *    const dateduration &operator/=(const unsigned int ddd);
  3161. *
  3162. *   FUNCTION
  3163. *    Devide the dateduration object by a constant value.
  3164. *    If ddd is 0 you will get back an object with a duration of 0!
  3165. *
  3166. *   INPUTS
  3167. *    *this - dateduration object
  3168. *    ddd   - Division factor
  3169. *
  3170. *   RESULT
  3171. *    *this - Modified dateduration object
  3172. *
  3173. *   EXAMPLE
  3174. *    ...
  3175. *    dd /= 2;
  3176. *    ...
  3177. *
  3178. *   NOTES
  3179. *    None.
  3180. *
  3181. *   BUGS
  3182. *    No known bugs.
  3183. *
  3184. *   SEE ALSO
  3185. *    operator+(),operator-(),operator+=(),operator-=(),operator*(),
  3186. *    operator/(),operator*=()
  3187. *
  3188. ******************************************************************************/
  3189.  
  3190.   {
  3191.    if (ddd != 0)
  3192.     {
  3193.      this->days /= ddd;
  3194.      this->months /= ddd;
  3195.      this->years /= ddd;
  3196.     }
  3197.    else
  3198.     {
  3199.      this->days = 0;
  3200.      this->months = 0;
  3201.      this->years = 0;
  3202.     }
  3203.    return(*this);
  3204.   }
  3205.  
  3206.  
  3207.  const dateduration &dateduration::operator/=(const unsigned long ddd)
  3208.  
  3209. /****** DateClass/dateduration/operator/=() ***********************************
  3210. *
  3211. *   NAME
  3212. *    operator/=() -- Div through operator for dateduration object (V33)
  3213. *
  3214. *   SYNOPSIS
  3215. *    (*this) /= ddd;
  3216. *
  3217. *    const dateduration &operator/=(const unsigned long ddd);
  3218. *
  3219. *   FUNCTION
  3220. *    Devide the dateduration object by a constant value.
  3221. *    If ddd is 0 you will get back an object with a duration of 0!
  3222. *
  3223. *   INPUTS
  3224. *    *this - dateduration object
  3225. *    ddd   - Division factor
  3226. *
  3227. *   RESULT
  3228. *    *this - Modified dateduration object
  3229. *
  3230. *   EXAMPLE
  3231. *    ...
  3232. *    dd /= 2;
  3233. *    ...
  3234. *
  3235. *   NOTES
  3236. *    None.
  3237. *
  3238. *   BUGS
  3239. *    No known bugs.
  3240. *
  3241. *   SEE ALSO
  3242. *    operator+(),operator-(),operator+=(),operator-=(),operator*(),
  3243. *    operator/(),operator*=()
  3244. *
  3245. ******************************************************************************/
  3246.  
  3247.   {
  3248.    if (ddd != 0)
  3249.     {
  3250.      this->days /= ddd;
  3251.      this->months /= (int)ddd;
  3252.      this->years /= (int)ddd;
  3253.     }
  3254.    else
  3255.     {
  3256.      this->days = 0;
  3257.      this->months = 0;
  3258.      this->years = 0;
  3259.     }
  3260.    return(*this);
  3261.   }
  3262.  
  3263.  
  3264.  unsigned long dateduration::operator/(const dateduration &dd) const
  3265.  
  3266. /****** DateClass/dateduration/operator/() ************************************
  3267. *
  3268. *   NAME
  3269. *    operator/() -- Div operator for dateduration object (V33)
  3270. *
  3271. *   SYNOPSIS
  3272. *    ddf = (*this) / dd;
  3273. *
  3274. *    unsigned long operator/(const dateduration &dd) const;
  3275. *
  3276. *   FUNCTION
  3277. *    Devide the dateduration object by another dateduration object
  3278. *    to the devision factor.
  3279. *
  3280. *   INPUTS
  3281. *    *this - dateduration object
  3282. *    dd    - dateduration object
  3283. *
  3284. *   RESULT
  3285. *    ddf - Division factor
  3286. *
  3287. *   EXAMPLE
  3288. *    ...
  3289. *    ddf = dd1 / dd2;
  3290. *    ...
  3291. *
  3292. *   NOTES
  3293. *    None.
  3294. *
  3295. *   BUGS
  3296. *    No known bugs.
  3297. *
  3298. *   SEE ALSO
  3299. *    operator+(),operator-(),operator+=(),operator-=(),operator*(),
  3300. *    operator*=(),operator/=(),operator%()
  3301. *
  3302. ******************************************************************************/
  3303.  
  3304.   {
  3305.    if ((*this) >= dd)
  3306.      return((this->days + this->months * 30 + this->years * 365) / (dd.days + dd.months * 30 + dd.years * 365));
  3307.    else
  3308.      return((dd.days + dd.months * 30 + dd.years * 365) / (this->days + this->months * 30 + this->years * 365));
  3309.   }
  3310.  
  3311.  
  3312.  unsigned long dateduration::operator%(const dateduration &dd) const
  3313.  
  3314. /****** DateClass/dateduration/operator%() ************************************
  3315. *
  3316. *   NAME
  3317. *    operator%() -- Modulo operator for dateduration object (V33)
  3318. *
  3319. *   SYNOPSIS
  3320. *    ddf = (*this) % dd;
  3321. *
  3322. *    unsigned long operator%(const dateduration &dd) const;
  3323. *
  3324. *   FUNCTION
  3325. *    Modulo devide the dateduration object by another dateduration object
  3326. *    to the modulo factor.
  3327. *
  3328. *   INPUTS
  3329. *    *this - dateduration object
  3330. *    dd    - dateduration object
  3331. *
  3332. *   RESULT
  3333. *    ddf - Modulo factor
  3334. *
  3335. *   EXAMPLE
  3336. *    ...
  3337. *    ddf = dd1 % dd2;
  3338. *    ...
  3339. *
  3340. *   NOTES
  3341. *    None.
  3342. *
  3343. *   BUGS
  3344. *    No known bugs.
  3345. *
  3346. *   SEE ALSO
  3347. *    operator+(),operator-(),operator+=(),operator-=(),operator*(),
  3348. *    operator/(),operator*=(),operator/=()
  3349. *
  3350. ******************************************************************************/
  3351.  
  3352.   {
  3353.    if ((*this) >= dd)
  3354.      return((this->days + this->months * 30 + this->years * 365) % (dd.days + dd.months * 30 + dd.years * 365));
  3355.    else
  3356.      return((dd.days + dd.months * 30 + dd.years * 365) % (this->days + this->months * 30 + this->years * 365));
  3357.   }
  3358.  
  3359.  
  3360.  unsigned long dateduration::getdays(void) const
  3361.  
  3362. /****** DateClass/dateduration/getdays() **************************************
  3363. *
  3364. *   NAME
  3365. *    getdays() -- Get days of dateduration object (V33)
  3366. *
  3367. *   SYNOPSIS
  3368. *    days = (*this).getdays();
  3369. *
  3370. *    unsigned long getdays(void) const;
  3371. *
  3372. *   FUNCTION
  3373. *    Gets the number of days from the dateduration object.
  3374. *
  3375. *   INPUTS
  3376. *    *this - dateduration object
  3377. *
  3378. *   RESULT
  3379. *    days - Days of the dateduration object
  3380. *
  3381. *   EXAMPLE
  3382. *    ...
  3383. *    days = dd.getdays();
  3384. *    ...
  3385. *
  3386. *   NOTES
  3387. *    None.
  3388. *
  3389. *   BUGS
  3390. *    No known bugs.
  3391. *
  3392. *   SEE ALSO
  3393. *    getmonths(),getyears(),getindays()
  3394. *
  3395. ******************************************************************************/
  3396.  
  3397.   {
  3398.    return(this->days);
  3399.   }
  3400.  
  3401.  
  3402.  unsigned short dateduration::getmonths(void) const
  3403.  
  3404. /****** DateClass/dateduration/getmonths() ************************************
  3405. *
  3406. *   NAME
  3407. *    getmonths() -- Get months of dateduration object (V33)
  3408. *
  3409. *   SYNOPSIS
  3410. *    months = (*this).getmonths();
  3411. *
  3412. *    unsigned short getmonths(void) const;
  3413. *
  3414. *   FUNCTION
  3415. *    Gets the number of months from the dateduration object.
  3416. *
  3417. *   INPUTS
  3418. *    *this - dateduration object
  3419. *
  3420. *   RESULT
  3421. *    months - Months of the dateduration object
  3422. *
  3423. *   EXAMPLE
  3424. *    ...
  3425. *    months = dd.getmonths();
  3426. *    ...
  3427. *
  3428. *   NOTES
  3429. *    None.
  3430. *
  3431. *   BUGS
  3432. *    No known bugs.
  3433. *
  3434. *   SEE ALSO
  3435. *    getdays(),getyears(),getindays()
  3436. *
  3437. ******************************************************************************/
  3438.  
  3439.   {
  3440.    return(this->months);
  3441.   }
  3442.  
  3443.  
  3444.  unsigned short dateduration::getyears(void) const
  3445.  
  3446. /****** DateClass/dateduration/getyears() *************************************
  3447. *
  3448. *   NAME
  3449. *    getyears() -- Get years of dateduration object (V33)
  3450. *
  3451. *   SYNOPSIS
  3452. *    years = (*this).getyears();
  3453. *
  3454. *    unsigned short getyears(void) const;
  3455. *
  3456. *   FUNCTION
  3457. *    Gets the number of years from the dateduration object.
  3458. *
  3459. *   INPUTS
  3460. *    *this - dateduration object
  3461. *
  3462. *   RESULT
  3463. *    years - Years of the dateduration object
  3464. *
  3465. *   EXAMPLE
  3466. *    ...
  3467. *    years = dd.getyears();
  3468. *    ...
  3469. *
  3470. *   NOTES
  3471. *    None.
  3472. *
  3473. *   BUGS
  3474. *    No known bugs.
  3475. *
  3476. *   SEE ALSO
  3477. *    getdays(),getmonths(),getindays()
  3478. *
  3479. ******************************************************************************/
  3480.  
  3481.   {
  3482.    return(this->years);
  3483.   }
  3484.  
  3485.  
  3486.  unsigned long dateduration::getindays(void) const
  3487.  
  3488. /****** DateClass/dateduration/getindays() ************************************
  3489. *
  3490. *   NAME
  3491. *    getindays() -- Get dateduration in days of dateduration object (V33)
  3492. *
  3493. *   SYNOPSIS
  3494. *    days = (*this).getindays();
  3495. *
  3496. *    unsigned long getindays(void) const;
  3497. *
  3498. *   FUNCTION
  3499. *    Gets duration of the dateduration object in days.
  3500. *
  3501. *   INPUTS
  3502. *    *this - dateduration object
  3503. *
  3504. *   RESULT
  3505. *    days - Dateduration of the datedurationobject in days
  3506. *
  3507. *   EXAMPLE
  3508. *    ...
  3509. *    days = dd.getindays();
  3510. *    ...
  3511. *
  3512. *   NOTES
  3513. *    A month will be calculated as 30 days, a year as 365 days.
  3514. *
  3515. *   BUGS
  3516. *    No known bugs.
  3517. *
  3518. *   SEE ALSO
  3519. *    getdays(),getmonths(),getyears()
  3520. *
  3521. ******************************************************************************/
  3522.  
  3523.   {
  3524.    return(this->days + this->months * 30 + this->years * 365);
  3525.   }
  3526.  
  3527.  /* --- time -------------------------------------------------------------- */
  3528.  
  3529. /****** DateClass/time ********************************************************
  3530. *
  3531. *   NAME
  3532. *    time -- Class for times. (V33)
  3533. *
  3534. *   FUNCTION
  3535. *    This class maps 24h times.
  3536. *
  3537. *   NOTES
  3538. *    None.
  3539. *
  3540. *   BUGS
  3541. *    No known bugs.
  3542. *
  3543. *   SEE ALSO
  3544. *    timeduration,dateduration,date
  3545. *
  3546. ******************************************************************************/
  3547.  
  3548. /****i* DateClass/time/struct time ********************************************
  3549. *
  3550. *   NAME
  3551. *    struct time -- Private structure of time class (V33)
  3552. *
  3553. *   SYNOPSIS
  3554. *    struct time {
  3555. *             unsigned short hour,min,sec;
  3556. *             short zone;
  3557. *            };
  3558. *
  3559. *   FUNCTION
  3560. *    This structure holds the data of a 24h time for a special time zone.
  3561. *
  3562. *   ELEMENTS
  3563. *    hour - Hour of the time.
  3564. *    min  - Minute of the time.
  3565. *    sec  - Second of the time.
  3566. *    zone - Time zone of the time.
  3567. *
  3568. *   NOTES
  3569. *    None.
  3570. *
  3571. *   BUGS
  3572. *    No known bugs.
  3573. *
  3574. *   SEE ALSO
  3575. *    time(),operator==(),operator!=(),operator<(),operator>(),
  3576. *    operator<=(),operator>=(),operator+(),operator-(),operator+=(),
  3577. *    operator-=(),operator<<(),operator>>(),operator<<=(),operator>>=(),
  3578. *    operator[](),operator()(),gethour(),getmin(),getsec(),getzone(),
  3579. *    getjd(),date
  3580. *
  3581. ******************************************************************************/
  3582.  
  3583.  
  3584.   time::time(float jd, short zone)
  3585.  
  3586. /****** DateClass/time/time() *************************************************
  3587. *
  3588. *   NAME
  3589. *    time() -- Constructor of time class (V33)
  3590. *
  3591. *   SYNOPSIS
  3592. *    t = time(jd,zone=0);
  3593. *
  3594. *    time(float jd, short zone = 0);
  3595. *
  3596. *   FUNCTION
  3597. *    Constructor of the time class using the JD format.
  3598. *
  3599. *   INPUTS
  3600. *    jd    - Time in JD format
  3601. *    zone  - Timezone of the time
  3602. *
  3603. *   RESULT
  3604. *    t - Time object
  3605. *
  3606. *   EXAMPLE
  3607. *    ...
  3608. *    time t(0.5,2);
  3609. *    ...
  3610. *
  3611. *   NOTES
  3612. *    None.
  3613. *
  3614. *   BUGS
  3615. *    No known bugs.
  3616. *
  3617. *   SEE ALSO
  3618. *    time(),Date/JDToTime()
  3619. *
  3620. ******************************************************************************/
  3621.  
  3622.   {
  3623.    if ((zone >= -12) && (zone <= 12))
  3624.     {
  3625.      this->zone = zone;
  3626.      JDToTime(jd,this->hour,this->min,this->sec);
  3627.     }
  3628.    else
  3629.     {
  3630.      this->hour = 0;
  3631.      this->min = 0;
  3632.      this->sec = 0;
  3633.      this->zone = 0;
  3634.     }
  3635.   }
  3636.  
  3637.  
  3638.   time::time(double jd, short zone)
  3639.  
  3640. /****** DateClass/time/time() *************************************************
  3641. *
  3642. *   NAME
  3643. *    time() -- Constructor of time class (V33)
  3644. *
  3645. *   SYNOPSIS
  3646. *    t = time(jd,zone=0);
  3647. *
  3648. *    time(double jd, short zone = 0);
  3649. *
  3650. *   FUNCTION
  3651. *    Constructor of the time class using the JD format.
  3652. *
  3653. *   INPUTS
  3654. *    jd    - Time in JD format
  3655. *    zone  - Timezone of the time
  3656. *
  3657. *   RESULT
  3658. *    t - Time object
  3659. *
  3660. *   EXAMPLE
  3661. *    ...
  3662. *    time t(0.5,2);
  3663. *    ...
  3664. *
  3665. *   NOTES
  3666. *    None.
  3667. *
  3668. *   BUGS
  3669. *    No known bugs.
  3670. *
  3671. *   SEE ALSO
  3672. *    time(),Date/JDToTime()
  3673. *
  3674. ******************************************************************************/
  3675.  
  3676.   {
  3677.    if ((zone >= -12) && (zone <= 12))
  3678.     {
  3679.      this->zone = zone;
  3680.      JDToTime((float)jd,this->hour,this->min,this->sec);
  3681.     }
  3682.    else
  3683.     {
  3684.      this->hour = 0;
  3685.      this->min = 0;
  3686.      this->sec = 0;
  3687.      this->zone = 0;
  3688.     }
  3689.   }
  3690.  
  3691.  
  3692.  time::time(unsigned short hour, unsigned short min, unsigned short sec, short zone)
  3693.  
  3694. /****** DateClass/time/time() *************************************************
  3695. *
  3696. *   NAME
  3697. *    time() -- Constructor of time class (V33)
  3698. *
  3699. *   SYNOPSIS
  3700. *    t = time(hour=0,min=0,sec=0,zone=0);
  3701. *
  3702. *    time(unsigned short hour=0, unsigned short min=0, unsigned short sec=0,
  3703. *        short zone=0);
  3704. *
  3705. *   FUNCTION
  3706. *    Constructor of the time class.
  3707. *
  3708. *   INPUTS
  3709. *    hour  - Hour of time
  3710. *    min   - Min of time
  3711. *    sec   - Sec of time
  3712. *    zone  - Timezone of time
  3713. *
  3714. *   RESULT
  3715. *    t - Time object
  3716. *
  3717. *   EXAMPLE
  3718. *    ...
  3719. *    time t(12,1,58,2);
  3720. *    ...
  3721. *
  3722. *   NOTES
  3723. *    None.
  3724. *
  3725. *   BUGS
  3726. *    No known bugs.
  3727. *
  3728. *   SEE ALSO
  3729. *    time()
  3730. *
  3731. ******************************************************************************/
  3732.  
  3733.   {
  3734.    if ((zone >= -12) && (zone <= 12))
  3735.     {
  3736.      this->hour = hour;
  3737.      this->min = min;
  3738.      this->sec = sec;
  3739.      this->zone = zone;
  3740.     }
  3741.    else
  3742.     {
  3743.      this->hour = 0;
  3744.      this->min = 0;
  3745.      this->sec = 0;
  3746.      this->zone = 0;
  3747.     }
  3748.   }
  3749.  
  3750.  
  3751.  bool time::operator==(time t) const
  3752.  
  3753. /****** DateClass/time/operator==() *******************************************
  3754. *
  3755. *   NAME
  3756. *    operator==() -- Equal operator for time objects (V33)
  3757. *
  3758. *   SYNOPSIS
  3759. *    compare = ((*this) == t);
  3760. *
  3761. *    bool operator==(time t) const;
  3762. *
  3763. *   FUNCTION
  3764. *    Compares two time objects for equality.
  3765. *
  3766. *   INPUTS
  3767. *    *this - time object
  3768. *    t     - time object
  3769. *
  3770. *   RESULT
  3771. *    compare - Boolean result of the equal compare operation
  3772. *
  3773. *   EXAMPLE
  3774. *    ...
  3775. *    if (t1 == t2)
  3776. *      printf("==\n");
  3777. *    else
  3778. *      printf("!=\n");
  3779. *    ...
  3780. *
  3781. *   NOTES
  3782. *    None.
  3783. *
  3784. *   BUGS
  3785. *    No known bugs.
  3786. *
  3787. *   SEE ALSO
  3788. *    operator!=(),operator<(),operator>(),operator<=(),operator>=(),
  3789. *    operator[](),Date/Compare2Times()
  3790. *
  3791. ******************************************************************************/
  3792.  
  3793.   {
  3794.    if (this->zone != t.zone)
  3795.      t[this->zone];
  3796.    return(Compare2Times(this->hour,this->min,this->sec,t.hour,t.min,t.sec) == 0);
  3797.   }
  3798.  
  3799.  
  3800.  bool time::operator!=(time t) const
  3801.  
  3802. /****** DateClass/time/operator!=() *******************************************
  3803. *
  3804. *   NAME
  3805. *    operator!=() -- Unequal operator for time objects (V33)
  3806. *
  3807. *   SYNOPSIS
  3808. *    compare = ((*this) != t);
  3809. *
  3810. *    bool operator!=(time t) const;
  3811. *
  3812. *   FUNCTION
  3813. *    Compares two time objects for unequality.
  3814. *
  3815. *   INPUTS
  3816. *    *this - time object
  3817. *    t     - time object
  3818. *
  3819. *   RESULT
  3820. *    compare - Boolean result of the unequal compare operation
  3821. *
  3822. *   EXAMPLE
  3823. *    ...
  3824. *    if (t1 != t2)
  3825. *      printf("!=\n");
  3826. *    else
  3827. *      printf("==\n");
  3828. *    ...
  3829. *
  3830. *   NOTES
  3831. *    None.
  3832. *
  3833. *   BUGS
  3834. *    No known bugs.
  3835. *
  3836. *   SEE ALSO
  3837. *    operator==(),operator<(),operator>(),operator<=(),operator>=(),
  3838. *    operator[](),Date/Compare2Times()
  3839. *
  3840. ******************************************************************************/
  3841.  
  3842.   {
  3843.    if (this->zone != t.zone)
  3844.      t[this->zone];
  3845.    return(Compare2Times(this->hour,this->min,this->sec,t.hour,t.min,t.sec) != 0);
  3846.   }
  3847.  
  3848.  
  3849.  bool time::operator< (time t) const
  3850.  
  3851. /****** DateClass/time/operator<() ********************************************
  3852. *
  3853. *   NAME
  3854. *    operator<() -- Lower than operator for time objects (V33)
  3855. *
  3856. *   SYNOPSIS
  3857. *    compare = ((*this) < t);
  3858. *
  3859. *    bool operator<(time t) const;
  3860. *
  3861. *   FUNCTION
  3862. *    Compares if time object 1 is lower than time object 2.
  3863. *
  3864. *   INPUTS
  3865. *    *this - time object
  3866. *    t     - time object
  3867. *
  3868. *   RESULT
  3869. *    compare - Boolean result of the lower than compare operation
  3870. *
  3871. *   EXAMPLE
  3872. *    ...
  3873. *    if (t1 < t2)
  3874. *      printf("<\n");
  3875. *    else
  3876. *      printf(">=\n");
  3877. *    ...
  3878. *
  3879. *   NOTES
  3880. *    None.
  3881. *
  3882. *   BUGS
  3883. *    No known bugs.
  3884. *
  3885. *   SEE ALSO
  3886. *    operator==(),operator!=(),operator>(),operator<=(),operator>=(),
  3887. *    operator[](),Date/Compare2Times()
  3888. *
  3889. ******************************************************************************/
  3890.  
  3891.   {
  3892.    if (this->zone != t.zone)
  3893.      t[this->zone];
  3894.    return(Compare2Times(this->hour,this->min,this->sec,t.hour,t.min,t.sec) == -1);
  3895.   }
  3896.  
  3897.  
  3898.  bool time::operator> (time t) const
  3899.  
  3900. /****** DateClass/time/operator>() ********************************************
  3901. *
  3902. *   NAME
  3903. *    operator>() -- Greater than operator for time objects (V33)
  3904. *
  3905. *   SYNOPSIS
  3906. *    compare = ((*this) > t);
  3907. *
  3908. *    bool operator>(time t) const;
  3909. *
  3910. *   FUNCTION
  3911. *    Compares if time object 1 is greater than time object 2.
  3912. *
  3913. *   INPUTS
  3914. *    *this - time object
  3915. *    t     - time object
  3916. *
  3917. *   RESULT
  3918. *    compare - Boolean result of the greater than compare operation
  3919. *
  3920. *   EXAMPLE
  3921. *    ...
  3922. *    if (t1 > t2)
  3923. *      printf(">\n");
  3924. *    else
  3925. *      printf("<=\n");
  3926. *    ...
  3927. *
  3928. *   NOTES
  3929. *    None.
  3930. *
  3931. *   BUGS
  3932. *    No known bugs.
  3933. *
  3934. *   SEE ALSO
  3935. *    operator==(),operator!=(),operator<(),operator<=(),operator>=(),
  3936. *    operator[](),Date/Compare2Times()
  3937. *
  3938. ******************************************************************************/
  3939.  
  3940.   {
  3941.    if (this->zone != t.zone)
  3942.      t[this->zone];
  3943.    return(Compare2Times(this->hour,this->min,this->sec,t.hour,t.min,t.sec) == 1);
  3944.   }
  3945.  
  3946.  
  3947.  bool time::operator<=(time t) const
  3948.  
  3949. /****** DateClass/time/operator<=() *******************************************
  3950. *
  3951. *   NAME
  3952. *    operator<=() -- Lower or equal operator for time objects (V33)
  3953. *
  3954. *   SYNOPSIS
  3955. *    compare = ((*this) <= t);
  3956. *
  3957. *    bool operator<=(time t) const;
  3958. *
  3959. *   FUNCTION
  3960. *    Compares if time object 1 is lower or equal than time object 2.
  3961. *
  3962. *   INPUTS
  3963. *    *this - time object
  3964. *    t     - time object
  3965. *
  3966. *   RESULT
  3967. *    compare - Boolean result of the lower or equal compare operation
  3968. *
  3969. *   EXAMPLE
  3970. *    ...
  3971. *    if (t1 <= t2)
  3972. *      printf("<=\n");
  3973. *    else
  3974. *      printf(">\n");
  3975. *    ...
  3976. *
  3977. *   NOTES
  3978. *    None.
  3979. *
  3980. *   BUGS
  3981. *    No known bugs.
  3982. *
  3983. *   SEE ALSO
  3984. *    operator==(),operator!=(),operator<(),operator>(),operator>=(),
  3985. *    operator[](),Date/Compare2Times()
  3986. *
  3987. ******************************************************************************/
  3988.  
  3989.   {
  3990.    if (this->zone != t.zone)
  3991.      t[this->zone];
  3992.    return(Compare2Times(this->hour,this->min,this->sec,t.hour,t.min,t.sec) <= 0);
  3993.   }
  3994.  
  3995.  
  3996.  bool time::operator>=(time t) const
  3997.  
  3998. /****** DateClass/time/operator>=() *******************************************
  3999. *
  4000. *   NAME
  4001. *    operator>=() -- Greater or equal operator for time objects (V33)
  4002. *
  4003. *   SYNOPSIS
  4004. *    compare = ((*this) >= t);
  4005. *
  4006. *    bool operator>=(time t) const;
  4007. *
  4008. *   FUNCTION
  4009. *    Compares if time object 1 is greater or equal than time object 2.
  4010. *
  4011. *   INPUTS
  4012. *    *this - time object
  4013. *    t     - time object
  4014. *
  4015. *   RESULT
  4016. *    compare - Boolean result of the greater or equal compare operation
  4017. *
  4018. *   EXAMPLE
  4019. *    ...
  4020. *    if (t1 >= t2)
  4021. *      printf(">=\n");
  4022. *    else
  4023. *      printf("<\n");
  4024. *    ...
  4025. *
  4026. *   NOTES
  4027. *    None.
  4028. *
  4029. *   BUGS
  4030. *    No known bugs.
  4031. *
  4032. *   SEE ALSO
  4033. *    operator==(),operator!=(),operator<(),operator>(),operator<=(),
  4034. *    operator[](),Date/Compare2Times()
  4035. *
  4036. ******************************************************************************/
  4037.  
  4038.   {
  4039.    if (this->zone != t.zone)
  4040.      t[this->zone];
  4041.    return(Compare2Times(this->hour,this->min,this->sec,t.hour,t.min,t.sec) >= 0);
  4042.   }
  4043.  
  4044.  
  4045.  timeduration time::operator-(time t) const
  4046.  
  4047. /****** DateClass/time/operator-() ********************************************
  4048. *
  4049. *   NAME
  4050. *    operator-() -- Sub operator for time objects (V33)
  4051. *
  4052. *   SYNOPSIS
  4053. *    td = (*this) - t;
  4054. *
  4055. *    timeduration operator-(time t) const;
  4056. *
  4057. *   FUNCTION
  4058. *    Subtract time object 2 from time object 1 to a new timeduration object.
  4059. *
  4060. *   INPUTS
  4061. *    *this - time object
  4062. *    t     - time object
  4063. *
  4064. *   RESULT
  4065. *    td - New timeduration object
  4066. *
  4067. *   EXAMPLE
  4068. *    ...
  4069. *    td = t1 - t2;
  4070. *    ...
  4071. *
  4072. *   NOTES
  4073. *    None.
  4074. *
  4075. *   BUGS
  4076. *    No known bugs.
  4077. *
  4078. *   SEE ALSO
  4079. *    operator+(),operator-(),timeduration(),operator[](),Date/TimeDiff(),
  4080. *    Date/SecToTime()
  4081. *
  4082. ******************************************************************************/
  4083.  
  4084.   {
  4085.    unsigned short hours,mins,secs;
  4086.    long hsecs;
  4087.  
  4088.    if (this->zone != t.zone)
  4089.      t[this->zone];
  4090.    hsecs = TimeDiff(this->hour,this->min,this->sec,t.hour,t.min,t.sec);
  4091.    if (hsecs < 0)
  4092.      hsecs = -hsecs;
  4093.    SecToTime(hsecs,hours,mins,secs);
  4094.    return(timeduration(hours,mins,secs));
  4095.   }
  4096.  
  4097.  
  4098.  time time::operator+(const timeduration &td) const
  4099.  
  4100. /****** DateClass/time/operator+() ********************************************
  4101. *
  4102. *   NAME
  4103. *    operator+() -- Add operator for time and timeduration objects (V33)
  4104. *
  4105. *   SYNOPSIS
  4106. *    t = (*this) + td;
  4107. *
  4108. *    time operator+(const timeduration &td) const;
  4109. *
  4110. *   FUNCTION
  4111. *    Add a time object and a timeduration object to a new time object.
  4112. *
  4113. *   INPUTS
  4114. *    *this - time object
  4115. *    td    - timeduration object
  4116. *
  4117. *   RESULT
  4118. *    t - New time object
  4119. *
  4120. *   EXAMPLE
  4121. *    ...
  4122. *    t1 = t2 + td;
  4123. *    ...
  4124. *
  4125. *   NOTES
  4126. *    None.
  4127. *
  4128. *   BUGS
  4129. *    No known bugs.
  4130. *
  4131. *   SEE ALSO
  4132. *    operator-(),operator+=(),operator-=(),time(),timeduration/getinsecs(),
  4133. *    Date/DiffTime()
  4134. *
  4135. ******************************************************************************/
  4136.  
  4137.   {
  4138.    unsigned short hour,min,sec;
  4139.  
  4140.    DiffTime(this->hour,this->min,this->sec,-td.getinsecs(),hour,min,sec);
  4141.    return(time(hour,min,sec));
  4142.   }
  4143.  
  4144.  
  4145.  time time::operator-(const timeduration &td) const
  4146.  
  4147. /****** DateClass/time/operator-() ********************************************
  4148. *
  4149. *   NAME
  4150. *    operator-() -- Sub operator for time and timeduration objects (V33)
  4151. *
  4152. *   SYNOPSIS
  4153. *    t = (*this) - td;
  4154. *
  4155. *    time operator-(const timeduration &td) const;
  4156. *
  4157. *   FUNCTION
  4158. *    Subtract a timeduration object from a time object to a new time object.
  4159. *
  4160. *   INPUTS
  4161. *    *this - time object
  4162. *    td    - timeduration object
  4163. *
  4164. *   RESULT
  4165. *    t - New time object
  4166. *
  4167. *   EXAMPLE
  4168. *    ...
  4169. *    t1 = t2 - td;
  4170. *    ...
  4171. *
  4172. *   NOTES
  4173. *    None.
  4174. *
  4175. *   BUGS
  4176. *    No known bugs.
  4177. *
  4178. *   SEE ALSO
  4179. *    operator+(),operator+=(),operator-=(),time(),timeduration/getinsecs(),
  4180. *    Date/DiffTime(),
  4181. *
  4182. ******************************************************************************/
  4183.  
  4184.   {
  4185.    unsigned short hour,min,sec;
  4186.  
  4187.    DiffTime(this->hour,this->min,this->sec,-td.getinsecs(),hour,min,sec);
  4188.    return(time(hour,min,sec));
  4189.   }
  4190.  
  4191.  
  4192.  const time &time::operator+=(const timeduration &td)
  4193.  
  4194. /****** DateClass/time/operator+=() *******************************************
  4195. *
  4196. *   NAME
  4197. *    operator+=() -- Add to operator for time and timeduration objects (V33)
  4198. *
  4199. *   SYNOPSIS
  4200. *    (*this) += td;
  4201. *
  4202. *    const time &operator+=(const timeduration &td);
  4203. *
  4204. *   FUNCTION
  4205. *    Add a timeduration object to a time object.
  4206. *
  4207. *   INPUTS
  4208. *    *this - time object
  4209. *    td    - timeduration object
  4210. *
  4211. *   RESULT
  4212. *    *this - Modified time object
  4213. *
  4214. *   EXAMPLE
  4215. *    ...
  4216. *    t += td;
  4217. *    ...
  4218. *
  4219. *   NOTES
  4220. *    None.
  4221. *
  4222. *   BUGS
  4223. *    No known bugs.
  4224. *
  4225. *   SEE ALSO
  4226. *    operator+(),operator-(),operator-=(),timeduration/getinsecs(),
  4227. *    Date/DiffTime()
  4228. *
  4229. ******************************************************************************/
  4230.  
  4231.   {
  4232.    DiffTime(this->hour,this->min,this->sec,td.getinsecs(),this->hour,this->min,this->sec);
  4233.    return(*this);
  4234.   }
  4235.  
  4236.  
  4237.  const time &time::operator-=(const timeduration &td)
  4238.  
  4239. /****** DateClass/time/operator-=() *******************************************
  4240. *
  4241. *   NAME
  4242. *    operator-=() -- Sub from operator for time and timeduration objs (V33)
  4243. *
  4244. *   SYNOPSIS
  4245. *    (*this) -= td;
  4246. *
  4247. *    const time &operator-=(const timeduration &td);
  4248. *
  4249. *   FUNCTION
  4250. *    Subtract a timeduration object from a time object.
  4251. *
  4252. *   INPUTS
  4253. *    *this - time object
  4254. *    td    - timeduration object
  4255. *
  4256. *   RESULT
  4257. *    *this - Modified time object
  4258. *
  4259. *   EXAMPLE
  4260. *    ...
  4261. *    t -= td;
  4262. *    ...
  4263. *
  4264. *   NOTES
  4265. *    None.
  4266. *
  4267. *   BUGS
  4268. *    No known bugs.
  4269. *
  4270. *   SEE ALSO
  4271. *    operator+(),operator-(),operator+=(),timeduration/getinsecs(),
  4272. *    Date/DiffTime()
  4273. *
  4274. ******************************************************************************/
  4275.  
  4276.   {
  4277.    DiffTime(this->hour,this->min,this->sec,-td.getinsecs(),this->hour,this->min,this->sec);
  4278.    return(*this);
  4279.   }
  4280.  
  4281.  
  4282.  time time::operator<<(const unsigned short subzone) const
  4283.  
  4284. /****** DateClass/time/operator<<() *******************************************
  4285. *
  4286. *   NAME
  4287. *    operator<<() -- Decrement timezone operator for time object (V33)
  4288. *
  4289. *   SYNOPSIS
  4290. *    t = (*this) << subzone;
  4291. *
  4292. *    time operator<<(const unsigned short subzone) const;
  4293. *
  4294. *   FUNCTION
  4295. *    Decrement the timezone of a time object to a new time object.
  4296. *
  4297. *   INPUTS
  4298. *    *this   - time object
  4299. *    subzone - Subtract this value from the actual timezone
  4300. *
  4301. *   RESULT
  4302. *    t - New time object
  4303. *
  4304. *   EXAMPLE
  4305. *    ...
  4306. *    t1 = t2 << 2;
  4307. *    ...
  4308. *
  4309. *   NOTES
  4310. *    None.
  4311. *
  4312. *   BUGS
  4313. *    No known bugs.
  4314. *
  4315. *   SEE ALSO
  4316. *    operator>>(),operator<<=(),operator>>=(),operator[](),operator()(),
  4317. *    time(),Date/DiffTime()
  4318. *
  4319. ******************************************************************************/
  4320.  
  4321.   {
  4322.    unsigned short hour,min,sec;
  4323.  
  4324.    if ((this->zone - (short)subzone) >= -12)
  4325.     {
  4326.      DiffTime(this->hour,this->min,this->sec,-subzone*3600,hour,min,sec);
  4327.      return(time(hour,min,sec,this->zone-subzone));
  4328.     }
  4329.    else
  4330.      return(time(0,0,0,0));
  4331.   }
  4332.  
  4333.  
  4334.  time time::operator>>(const unsigned short addzone) const
  4335.  
  4336. /****** DateClass/time/operator>>() *******************************************
  4337. *
  4338. *   NAME
  4339. *    operator>>() -- Increment timezone operator for time object (V33)
  4340. *
  4341. *   SYNOPSIS
  4342. *    t = (*this) >> addzone;
  4343. *
  4344. *    time operator>>(const unsigned short addzone) const;
  4345. *
  4346. *   FUNCTION
  4347. *    Increment the timezone of a time object to a new time object.
  4348. *
  4349. *   INPUTS
  4350. *    *this   - time object
  4351. *    addzone - Add this value to the actual timezone
  4352. *
  4353. *   RESULT
  4354. *    t - New time object
  4355. *
  4356. *   EXAMPLE
  4357. *    ...
  4358. *    t1 = t2 >> 2;
  4359. *    ...
  4360. *
  4361. *   NOTES
  4362. *    None.
  4363. *
  4364. *   BUGS
  4365. *    No known bugs.
  4366. *
  4367. *   SEE ALSO
  4368. *    operator<<(),operator<<=(),operator>>=(),operator[](),operator()(),
  4369. *    time(),Date/DiffTime()
  4370. *
  4371. ******************************************************************************/
  4372.  
  4373.   {
  4374.    unsigned short hour,min,sec;
  4375.  
  4376.    if ((this->zone + addzone) <= 12)
  4377.     {
  4378.      DiffTime(this->hour,this->min,this->sec,addzone*3600,hour,min,sec);
  4379.      return(time(hour,min,sec,this->zone+addzone));
  4380.     }
  4381.    else
  4382.      return(time(0,0,0,0));
  4383.   }
  4384.  
  4385.  
  4386.  const time &time::operator<<=(const unsigned short subzone)
  4387.  
  4388. /****** DateClass/time/operator<<=() ******************************************
  4389. *
  4390. *   NAME
  4391. *    operator<<=() -- Decrement timezone operator for time object (V33)
  4392. *
  4393. *   SYNOPSIS
  4394. *    (*this) <<= subzone;
  4395. *
  4396. *    const time &operator<<=(const unsigned short subzone);
  4397. *
  4398. *   FUNCTION
  4399. *    Decrement the timezone of a time object.
  4400. *
  4401. *   INPUTS
  4402. *    *this   - time object
  4403. *    subzone - Subtract this value from the actual timezone
  4404. *
  4405. *   RESULT
  4406. *    *this - Modified time object
  4407. *
  4408. *   EXAMPLE
  4409. *    ...
  4410. *    t <<= 2;
  4411. *    ...
  4412. *
  4413. *   NOTES
  4414. *    None.
  4415. *
  4416. *   BUGS
  4417. *    No known bugs.
  4418. *
  4419. *   SEE ALSO
  4420. *    operator<<(),operator>>(),operator>>=(),operator[](),operator()(),
  4421. *    Date/DiffTime()
  4422. *
  4423. ******************************************************************************/
  4424.  
  4425.   {
  4426.    if ((this->zone - (short)subzone) >= -12)
  4427.     {
  4428.      DiffTime(this->hour,this->min,this->sec,-subzone*3600,this->hour,this->min,this->sec);
  4429.      this->zone -= subzone;
  4430.     }
  4431.    return(*this);
  4432.   }
  4433.  
  4434.  
  4435.  const time &time::operator>>=(const unsigned short addzone)
  4436.  
  4437. /****** DateClass/time/operator>>=() ******************************************
  4438. *
  4439. *   NAME
  4440. *    operator>>=() -- Increment timezone operator for time object (V33)
  4441. *
  4442. *   SYNOPSIS
  4443. *    (*this) >>= addzone;
  4444. *
  4445. *    const time &operator>>=(const unsigned short addzone);
  4446. *
  4447. *   FUNCTION
  4448. *    Increment the timezone of a time object.
  4449. *
  4450. *   INPUTS
  4451. *    *this   - time object
  4452. *    addzone - Add this value to the actual timezone
  4453. *
  4454. *   RESULT
  4455. *    *this - Modified time object
  4456. *
  4457. *   EXAMPLE
  4458. *    ...
  4459. *    t >>= 2;
  4460. *    ...
  4461. *
  4462. *   NOTES
  4463. *    None.
  4464. *
  4465. *   BUGS
  4466. *    No known bugs.
  4467. *
  4468. *   SEE ALSO
  4469. *    operator<<(),operator>>(),operator<<=(),operator[](),operator()(),
  4470. *    Date/DiffTime()
  4471. *
  4472. ******************************************************************************/
  4473.  
  4474.   {
  4475.    if ((this->zone + addzone) <= 12)
  4476.     {
  4477.      DiffTime(this->hour,this->min,this->sec,addzone*3600,this->hour,this->min,this->sec);
  4478.      this->zone += addzone;
  4479.     }
  4480.    return(*this);
  4481.   }
  4482.  
  4483.  
  4484.  const time &time::operator[](const short zone) // t1[-5] = time(18,0,0,+3)
  4485.  
  4486. /****** DateClass/time/operator[]() *******************************************
  4487. *
  4488. *   NAME
  4489. *    operator[]() -- Change to timezone operator for time object (V33)
  4490. *
  4491. *   SYNOPSIS
  4492. *    (*this) = (*this)[zone];
  4493. *
  4494. *    const time &operator[](const short zone);
  4495. *
  4496. *   FUNCTION
  4497. *    Change the timezone of a time object to another timezone.
  4498. *
  4499. *   INPUTS
  4500. *    *this - time object
  4501. *    zone  - Add this value to the actual timezone
  4502. *
  4503. *   RESULT
  4504. *    *this - Modified time object
  4505. *
  4506. *   EXAMPLE
  4507. *    ...
  4508. *    t[2];
  4509. *    t1 = t2[2];
  4510. *    ...
  4511. *
  4512. *   NOTES
  4513. *    None.
  4514. *
  4515. *   BUGS
  4516. *    No known bugs.
  4517. *
  4518. *   SEE ALSO
  4519. *    operator<<(),operator>>(),operator<<=(),operator>>=(),operator()(),
  4520. *    Date/DiffTime()
  4521. *
  4522. ******************************************************************************/
  4523.  
  4524.   {
  4525.    if ((zone >= -12) && (zone <= 12) && (zone != this->zone))
  4526.     {
  4527.      DiffTime(this->hour,this->min,this->sec,(zone-this->zone)*3600,this->hour,this->min,this->sec);
  4528.      this->zone = zone;
  4529.     }
  4530.    return(*this);
  4531.   }
  4532.  
  4533.  
  4534.  time time::operator()(const short zone) const
  4535.  
  4536. /****** DateClass/time/operator()() *******************************************
  4537. *
  4538. *   NAME
  4539. *    operator()() -- Calc. to new timezone operator for time object (V33)
  4540. *
  4541. *   SYNOPSIS
  4542. *    t = (*this)(zone);
  4543. *
  4544. *    time operator()(const short zone) const;
  4545. *
  4546. *   FUNCTION
  4547. *    Change the timezone of a time object to a new time object with another
  4548. *    timezone
  4549. *
  4550. *   INPUTS
  4551. *    *this - time object
  4552. *    zone  - Add this value to the actual timezone
  4553. *
  4554. *   RESULT
  4555. *    t - New time object
  4556. *
  4557. *   EXAMPLE
  4558. *    ...
  4559. *    t1 = t2(2);
  4560. *    ...
  4561. *
  4562. *   NOTES
  4563. *    None.
  4564. *
  4565. *   BUGS
  4566. *    No known bugs.
  4567. *
  4568. *   SEE ALSO
  4569. *    operator<<(),operator>>(),operator<<=(),operator>>=(),operator[](),
  4570. *    time(),Date/DiffTime()
  4571. *
  4572. ******************************************************************************/
  4573.  
  4574.   {
  4575.    unsigned short hour=0,min=0,sec=0;
  4576.  
  4577.    if ((zone >= -12) && (zone <= 12))
  4578.      DiffTime(this->hour,this->min,this->sec,(zone-this->zone)*3600,hour,min,sec);
  4579.    return(time(hour,min,sec,zone));
  4580.   }
  4581.  
  4582.  
  4583.  unsigned short time::gethour(void) const
  4584.  
  4585. /****** DateClass/time/gethour() **********************************************
  4586. *
  4587. *   NAME
  4588. *    gethour() -- Get hour of time object (V33)
  4589. *
  4590. *   SYNOPSIS
  4591. *    hour = (*this).gethour();
  4592. *
  4593. *    unsigned short gethour(void) const;
  4594. *
  4595. *   FUNCTION
  4596. *    Get the hour from the time object.
  4597. *
  4598. *   INPUTS
  4599. *    *this - time object
  4600. *
  4601. *   RESULT
  4602. *    hour - Hour of the time object
  4603. *
  4604. *   EXAMPLE
  4605. *    ...
  4606. *    hour = t.gethour();
  4607. *    ...
  4608. *
  4609. *   NOTES
  4610. *    None.
  4611. *
  4612. *   BUGS
  4613. *    No known bugs.
  4614. *
  4615. *   SEE ALSO
  4616. *    getmin(),getsec(),getzone(),getjd()
  4617. *
  4618. ******************************************************************************/
  4619.  
  4620.   {
  4621.    return(this->hour);
  4622.   }
  4623.  
  4624.  
  4625.  unsigned short time::getmin(void) const
  4626.  
  4627. /****** DateClass/time/getmin() ***********************************************
  4628. *
  4629. *   NAME
  4630. *    getmin() -- Get min of time object (V33)
  4631. *
  4632. *   SYNOPSIS
  4633. *    min = (*this).getmin();
  4634. *
  4635. *    unsigned short getmin(void) const;
  4636. *
  4637. *   FUNCTION
  4638. *    Get the minute from the time object.
  4639. *
  4640. *   INPUTS
  4641. *    *this - time object
  4642. *
  4643. *   RESULT
  4644. *    min - Minute of the time object
  4645. *
  4646. *   EXAMPLE
  4647. *    ...
  4648. *    min = t.getmin();
  4649. *    ...
  4650. *
  4651. *   NOTES
  4652. *    None.
  4653. *
  4654. *   BUGS
  4655. *    No known bugs.
  4656. *
  4657. *   SEE ALSO
  4658. *    gethour(),getsec(),getzone(),getjd()
  4659. *
  4660. ******************************************************************************/
  4661.  
  4662.   {
  4663.    return(this->min);
  4664.   }
  4665.  
  4666.  
  4667.  unsigned short time::getsec(void) const
  4668.  
  4669. /****** DateClass/time/getsec() ***********************************************
  4670. *
  4671. *   NAME
  4672. *    getsec() -- Get sec of time object (V33)
  4673. *
  4674. *   SYNOPSIS
  4675. *    sec = (*this).getsec();
  4676. *
  4677. *    unsigned short getsec(void) const;
  4678. *
  4679. *   FUNCTION
  4680. *    Get the second from the time object.
  4681. *
  4682. *   INPUTS
  4683. *    *this - time object
  4684. *
  4685. *   RESULT
  4686. *    sec - Second of the time object
  4687. *
  4688. *   EXAMPLE
  4689. *    ...
  4690. *    sec = t.getsec();
  4691. *    ...
  4692. *
  4693. *   NOTES
  4694. *    None.
  4695. *
  4696. *   BUGS
  4697. *    No known bugs.
  4698. *
  4699. *   SEE ALSO
  4700. *    gethour(),getmin(),getzone(),getjd()
  4701. *
  4702. ******************************************************************************/
  4703.  
  4704.   {
  4705.    return(this->sec);
  4706.   }
  4707.  
  4708.  
  4709.  short time::getzone(void) const
  4710.  
  4711. /****** DateClass/time/getzone() **********************************************
  4712. *
  4713. *   NAME
  4714. *    getzone() -- Get timezone of time object (V33)
  4715. *
  4716. *   SYNOPSIS
  4717. *    zone = (*this).getzone();
  4718. *
  4719. *    short getzone(void) const;
  4720. *
  4721. *   FUNCTION
  4722. *    Get the timezone from the time object.
  4723. *
  4724. *   INPUTS
  4725. *    *this - time object
  4726. *
  4727. *   RESULT
  4728. *    zone - Timezone of the time object
  4729. *
  4730. *   EXAMPLE
  4731. *    ...
  4732. *    zone = t.getzone();
  4733. *    ...
  4734. *
  4735. *   NOTES
  4736. *    None.
  4737. *
  4738. *   BUGS
  4739. *    No known bugs.
  4740. *
  4741. *   SEE ALSO
  4742. *    gethour(),getmin(),getsec(),getjd()
  4743. *
  4744. ******************************************************************************/
  4745.  
  4746.   {
  4747.    return(this->zone);
  4748.   }
  4749.  
  4750.  
  4751.  float time::getjd(void) const
  4752.  
  4753. /****** DateClass/time/getjd() ************************************************
  4754. *
  4755. *   NAME
  4756. *    getjd() -- Get time in JD format from time object (V33)
  4757. *
  4758. *   SYNOPSIS
  4759. *    jd = (*this).getjd();
  4760. *
  4761. *    float getjd(void) const;
  4762. *
  4763. *   FUNCTION
  4764. *    Get the time in JD format from the time object.
  4765. *
  4766. *   INPUTS
  4767. *    *this - time object
  4768. *
  4769. *   RESULT
  4770. *    jd - Time of the time object in JD format
  4771. *
  4772. *   EXAMPLE
  4773. *    ...
  4774. *    jd = t.getjd();
  4775. *    ...
  4776. *
  4777. *   NOTES
  4778. *    None.
  4779. *
  4780. *   BUGS
  4781. *    No known bugs.
  4782. *
  4783. *   SEE ALSO
  4784. *    gethour(),getmin(),getsec(),getzone(),Date/TimeToJD()
  4785. *
  4786. ******************************************************************************/
  4787.  
  4788.   {
  4789.    return(TimeToJD(this->hour,this->min,this->sec));
  4790.   }
  4791.  
  4792.  /* --- date -------------------------------------------------------------- */
  4793.  
  4794. /****** DateClass/date ********************************************************
  4795. *
  4796. *   NAME
  4797. *    date -- Class for dates. (V33)
  4798. *
  4799. *   FUNCTION
  4800. *    This class maps dates.
  4801. *
  4802. *   NOTES
  4803. *    None.
  4804. *
  4805. *   BUGS
  4806. *    No known bugs.
  4807. *
  4808. *   SEE ALSO
  4809. *    timeduration,dateduration,time
  4810. *
  4811. ******************************************************************************/
  4812.  
  4813. /****i* DateClass/date/struct date ********************************************
  4814. *
  4815. *   NAME
  4816. *    struct date -- Private structure of date class (V33)
  4817. *
  4818. *   SYNOPSIS
  4819. *    struct date {
  4820. *             unsigned short day,month;
  4821. *             int year;
  4822. *            };
  4823. *
  4824. *   FUNCTION
  4825. *    This structure holds the data of a date.
  4826. *
  4827. *   ELEMENTS
  4828. *    day   - Day of the date.
  4829. *    month - Month of the date.
  4830. *    year  - Year of the date.
  4831. *
  4832. *   NOTES
  4833. *    None.
  4834. *
  4835. *   BUGS
  4836. *    No known bugs.
  4837. *
  4838. *   SEE ALSO
  4839. *    date(),operator==(),operator!=(),operator<(),operator>(),
  4840. *    operator<=(),operator>=(),operator!(),operator+(),operator-(),
  4841. *    operator+=(),operator-=(),operator++(),operator++(int),operator--(),
  4842. *    operator--(int),getday(),getmonth(),getyear(),getweek(),getweekday(),
  4843. *    getjd(),getmjd(),getscaliger(),date
  4844. *
  4845. ******************************************************************************/
  4846.  
  4847.  
  4848.  date::date(unsigned long jd)
  4849.  
  4850. /****** DateClass/date/date() *************************************************
  4851. *
  4852. *   NAME
  4853. *    date() -- Constructor of date class (V33)
  4854. *
  4855. *   SYNOPSIS
  4856. *    d = date(jd);
  4857. *
  4858. *    date(unsigned long jd);
  4859. *
  4860. *   FUNCTION
  4861. *    Constructor of the date class for JD format.
  4862. *
  4863. *   INPUTS
  4864. *    jd - Date in JD format
  4865. *
  4866. *   RESULT
  4867. *    d - Date object
  4868. *
  4869. *   EXAMPLE
  4870. *    ...
  4871. *    date d(2449354);
  4872. *    ...
  4873. *
  4874. *   NOTES
  4875. *    None.
  4876. *
  4877. *   BUGS
  4878. *    No known bugs.
  4879. *
  4880. *   SEE ALSO
  4881. *    date(),Date/JDToHeis()
  4882. *
  4883. ******************************************************************************/
  4884.  
  4885.   {
  4886.    JDToHeis(jd,this->day,this->month,this->year);
  4887.   }
  4888.  
  4889.  
  4890.  date::date(unsigned short day, unsigned short month, int year)
  4891.  
  4892. /****** DateClass/date/date() *************************************************
  4893. *
  4894. *   NAME
  4895. *    date() -- Constructor of date class (V33)
  4896. *
  4897. *   SYNOPSIS
  4898. *    d = date(day,month,year);
  4899. *
  4900. *    date(unsigned short day, unsigned short month, int year);
  4901. *
  4902. *   FUNCTION
  4903. *    Constructor of the date class.
  4904. *
  4905. *   INPUTS
  4906. *    day   - Day of date
  4907. *    month - Month of date
  4908. *    year  - Year of date
  4909. *
  4910. *   RESULT
  4911. *    d - Date object
  4912. *
  4913. *   EXAMPLE
  4914. *    ...
  4915. *    date d(17,7,1995);
  4916. *    ...
  4917. *
  4918. *   NOTES
  4919. *    None.
  4920. *
  4921. *   BUGS
  4922. *    No known bugs.
  4923. *
  4924. *   SEE ALSO
  4925. *    date()
  4926. *
  4927. ******************************************************************************/
  4928.  
  4929.   {
  4930.    this->day = day;
  4931.    this->month = month;
  4932.    this->year = year;
  4933.   }
  4934.  
  4935.  
  4936.  bool date::operator==(const date &d) const
  4937.  
  4938. /****** DateClass/date/operator==() *******************************************
  4939. *
  4940. *   NAME
  4941. *    operator==() -- Equal operator for date objects (V33)
  4942. *
  4943. *   SYNOPSIS
  4944. *    compare = ((*this) == d);
  4945. *
  4946. *    bool operator==(const date &d) const;
  4947. *
  4948. *   FUNCTION
  4949. *    Compares two date objects for equality.
  4950. *
  4951. *   INPUTS
  4952. *    *this - date object
  4953. *    d     - date object
  4954. *
  4955. *   RESULT
  4956. *    compare - Boolean result of the equal compare operation
  4957. *
  4958. *   EXAMPLE
  4959. *    ...
  4960. *    if (d1 == d2)
  4961. *      printf("==\n");
  4962. *    else
  4963. *      printf("!=\n");
  4964. *    ...
  4965. *
  4966. *   NOTES
  4967. *    None.
  4968. *
  4969. *   BUGS
  4970. *    No known bugs.
  4971. *
  4972. *   SEE ALSO
  4973. *    operator!=(),operator<(),operator>(),operator<=(),operator>=(),
  4974. *    Date/Compre2Dates()
  4975. *
  4976. ******************************************************************************/
  4977.  
  4978.   {
  4979.    return(Compare2Dates(this->day,this->month,this->year,d.day,d.month,d.year) == 0);
  4980.   }
  4981.  
  4982.  
  4983.  bool date::operator!=(const date &d) const
  4984.  
  4985. /****** DateClass/date/operator!=() *******************************************
  4986. *
  4987. *   NAME
  4988. *    operator!=() -- Unequal operator for date objects (V33)
  4989. *
  4990. *   SYNOPSIS
  4991. *    compare = ((*this) != d);
  4992. *
  4993. *    bool operator!=(const date &d) const;
  4994. *
  4995. *   FUNCTION
  4996. *    Compares two date objects for unequality.
  4997. *
  4998. *   INPUTS
  4999. *    *this - date object
  5000. *    d     - date object
  5001. *
  5002. *   RESULT
  5003. *    compare - Boolean result of the unequal compare operation
  5004. *
  5005. *   EXAMPLE
  5006. *    ...
  5007. *    if (d1 != d2)
  5008. *      printf("!=\n");
  5009. *    else
  5010. *      printf("==\n");
  5011. *    ...
  5012. *
  5013. *   NOTES
  5014. *    None.
  5015. *
  5016. *   BUGS
  5017. *    No known bugs.
  5018. *
  5019. *   SEE ALSO
  5020. *    operator==(),operator<(),operator>(),operator<=(),operator>=(),
  5021. *    Date/Compare2Dates()
  5022. *
  5023. ******************************************************************************/
  5024.  
  5025.   {
  5026.    return(Compare2Dates(this->day,this->month,this->year,d.day,d.month,d.year) != 0);
  5027.   }
  5028.  
  5029.  
  5030.  bool date::operator< (const date &d) const
  5031.  
  5032. /****** DateClass/date/operator<() ********************************************
  5033. *
  5034. *   NAME
  5035. *    operator<() -- Lower than operator for date objects (V33)
  5036. *
  5037. *   SYNOPSIS
  5038. *    compare = ((*this) < d);
  5039. *
  5040. *    bool operator<(const date &d) const;
  5041. *
  5042. *   FUNCTION
  5043. *    Compares if date object 1 is lower than date object 2.
  5044. *
  5045. *   INPUTS
  5046. *    *this - date object
  5047. *    d     - date object
  5048. *
  5049. *   RESULT
  5050. *    compare - Boolean result of the lower than compare operation
  5051. *
  5052. *   EXAMPLE
  5053. *    ...
  5054. *    if (d1 < d2)
  5055. *      printf("<\n");
  5056. *    else
  5057. *      printf(">=\n");
  5058. *    ...
  5059. *
  5060. *   NOTES
  5061. *    None.
  5062. *
  5063. *   BUGS
  5064. *    No known bugs.
  5065. *
  5066. *   SEE ALSO
  5067. *    operator==(),operator!=(),operator>(),operator<=(),operator>=(),
  5068. *    Date/Compare2Dates()
  5069. *
  5070. ******************************************************************************/
  5071.  
  5072.   {
  5073.    return(Compare2Dates(this->day,this->month,this->year,d.day,d.month,d.year) == -1);
  5074.   }
  5075.  
  5076.  
  5077.  bool date::operator> (const date &d) const
  5078.  
  5079. /****** DateClass/date/operator>() ********************************************
  5080. *
  5081. *   NAME
  5082. *    operator>() -- Greater than operator for date objects (V33)
  5083. *
  5084. *   SYNOPSIS
  5085. *    compare = ((*this) > d);
  5086. *
  5087. *    bool operator>(const date &d) const;
  5088. *
  5089. *   FUNCTION
  5090. *    Compares if date object 1 is greater than date object 2.
  5091. *
  5092. *   INPUTS
  5093. *    *this - date object
  5094. *    d     - date object
  5095. *
  5096. *   RESULT
  5097. *    compare - Boolean result of the greater than compare operation
  5098. *
  5099. *   EXAMPLE
  5100. *    ...
  5101. *    if (d1 > d2)
  5102. *      printf(">\n");
  5103. *    else
  5104. *      printf("<=\n");
  5105. *    ...
  5106. *
  5107. *   NOTES
  5108. *    None.
  5109. *
  5110. *   BUGS
  5111. *    No known bugs.
  5112. *
  5113. *   SEE ALSO
  5114. *    operator==(),operator!=(),operator<(),operator<=(),operator>=(),
  5115. *    Date/Compare2Dates()
  5116. *
  5117. ******************************************************************************/
  5118.  
  5119.   {
  5120.    return(Compare2Dates(this->day,this->month,this->year,d.day,d.month,d.year) == 1);
  5121.   }
  5122.  
  5123.  
  5124.  bool date::operator<=(const date &d) const
  5125.  
  5126. /****** DateClass/date/operator<=() *******************************************
  5127. *
  5128. *   NAME
  5129. *    operator<=() -- Lower or equal operator for date objects (V33)
  5130. *
  5131. *   SYNOPSIS
  5132. *    compare = ((*this) <= d);
  5133. *
  5134. *    bool operator<=(const date &d) const;
  5135. *
  5136. *   FUNCTION
  5137. *    Compares if date object 1 is lower or equal than date object 2.
  5138. *
  5139. *   INPUTS
  5140. *    *this - date object
  5141. *    d     - date object
  5142. *
  5143. *   RESULT
  5144. *    compare - Boolean result of the lower or equal compare operation
  5145. *
  5146. *   EXAMPLE
  5147. *    ...
  5148. *    if (d1 <= d2)
  5149. *      printf("<=\n");
  5150. *    else
  5151. *      printf(">\n");
  5152. *    ...
  5153. *
  5154. *   NOTES
  5155. *    None.
  5156. *
  5157. *   BUGS
  5158. *    No known bugs.
  5159. *
  5160. *   SEE ALSO
  5161. *    operator==(),operator!=(),operator<(),operator>(),operator>=().
  5162. *    Date/Compare2Dates()
  5163. *
  5164. ******************************************************************************/
  5165.  
  5166.   {
  5167.    return(Compare2Dates(this->day,this->month,this->year,d.day,d.month,d.year) <= 0);
  5168.   }
  5169.  
  5170.  
  5171.  bool date::operator>=(const date &d) const
  5172.  
  5173. /****** DateClass/date/operator>=() *******************************************
  5174. *
  5175. *   NAME
  5176. *    operator>=() -- Greater or equal operator for date objects (V33)
  5177. *
  5178. *   SYNOPSIS
  5179. *    compare = ((*this) >= d);
  5180. *
  5181. *    bool operator>=(const date &d) const;
  5182. *
  5183. *   FUNCTION
  5184. *    Compares if date object 1 is greater or equal than date object 2.
  5185. *
  5186. *   INPUTS
  5187. *    *this - date object
  5188. *    d     - date object
  5189. *
  5190. *   RESULT
  5191. *    compare - Boolean result of the greater or equal compare operation
  5192. *
  5193. *   EXAMPLE
  5194. *    ...
  5195. *    if (d1 >= d2)
  5196. *      printf(">=\n");
  5197. *    else
  5198. *      printf("<\n");
  5199. *    ...
  5200. *
  5201. *   NOTES
  5202. *    None.
  5203. *
  5204. *   BUGS
  5205. *    No known bugs.
  5206. *
  5207. *   SEE ALSO
  5208. *    operator==(),operator!=(),operator<(),operator>(),operator<=(),
  5209. *    Date/Compare2Dates()
  5210. *
  5211. ******************************************************************************/
  5212.  
  5213.   {
  5214.    return(Compare2Dates(this->day,this->month,this->year,d.day,d.month,d.year) >= 0);
  5215.   }
  5216.  
  5217.  
  5218.  bool date::operator==(const Weekdays wd) const
  5219.  
  5220. /****** DateClass/date/operator==() *******************************************
  5221. *
  5222. *   NAME
  5223. *    operator==() -- Equal operator for date object and weekday (V33)
  5224. *
  5225. *   SYNOPSIS
  5226. *    compare = ((*this) == wd);
  5227. *
  5228. *    bool operator==(const Weekdays wd) const;
  5229. *
  5230. *   FUNCTION
  5231. *    Compares if the date object is equal to a weekday.
  5232. *
  5233. *   INPUTS
  5234. *    *this - date object
  5235. *    wd    - Weekday
  5236. *
  5237. *   RESULT
  5238. *    compare - Boolean result of the equal compare operation
  5239. *
  5240. *   EXAMPLE
  5241. *    ...
  5242. *    if (d1 == wd)
  5243. *      printf("==\n");
  5244. *    else
  5245. *      printf("!=\n");
  5246. *    ...
  5247. *
  5248. *   NOTES
  5249. *    None.
  5250. *
  5251. *   BUGS
  5252. *    No known bugs.
  5253. *
  5254. *   SEE ALSO
  5255. *    operator!=(),operator<(),operator>(),operator<=(),operator>=(),
  5256. *    Date/HeisWeekday()
  5257. *
  5258. ******************************************************************************/
  5259.  
  5260.   {
  5261.    return(HeisWeekday(this->day,this->month,this->year) == wd);
  5262.   }
  5263.  
  5264.  
  5265.  bool date::operator!=(const Weekdays wd) const
  5266.  
  5267. /****** DateClass/date/operator!=() *******************************************
  5268. *
  5269. *   NAME
  5270. *    operator!=() -- Unequal operator for date object and weekday (V33)
  5271. *
  5272. *   SYNOPSIS
  5273. *    compare = ((*this) != wd);
  5274. *
  5275. *    bool operator!=(const Weekdays wd) const;
  5276. *
  5277. *   FUNCTION
  5278. *    Compares if the date object is unequal to a weekday.
  5279. *
  5280. *   INPUTS
  5281. *    *this - date object
  5282. *    wd    - Weekday
  5283. *
  5284. *   RESULT
  5285. *    compare - Boolean result of the unequal compare operation
  5286. *
  5287. *   EXAMPLE
  5288. *    ...
  5289. *    if (d1 != wd)
  5290. *      printf("!=\n");
  5291. *    else
  5292. *      printf("==\n");
  5293. *    ...
  5294. *
  5295. *   NOTES
  5296. *    None.
  5297. *
  5298. *   BUGS
  5299. *    No known bugs.
  5300. *
  5301. *   SEE ALSO
  5302. *    operator==(),operator<(),operator>(),operator<=(),operator>=(),
  5303. *    Date/HeisWeekday()
  5304. *
  5305. ******************************************************************************/
  5306.  
  5307.   {
  5308.    return(HeisWeekday(this->day,this->month,this->year) != wd);
  5309.   }
  5310.  
  5311.  
  5312.  bool date::operator< (const Weekdays wd) const
  5313.  
  5314. /****** DateClass/date/operator<() ********************************************
  5315. *
  5316. *   NAME
  5317. *    operator<() -- Lower than operator for date object and weekday (V33)
  5318. *
  5319. *   SYNOPSIS
  5320. *    compare = ((*this) < wd);
  5321. *
  5322. *    bool operator< (const Weekdays wd) const;
  5323. *
  5324. *   FUNCTION
  5325. *    Compares if the date object is lower than a weekday.
  5326. *
  5327. *   INPUTS
  5328. *    *this - date object
  5329. *    wd    - Weekday
  5330. *
  5331. *   RESULT
  5332. *    compare - Boolean result of the lower than compare operation
  5333. *
  5334. *   EXAMPLE
  5335. *    ...
  5336. *    if (d1 < wd)
  5337. *      printf("<\n");
  5338. *    else
  5339. *      printf(">=\n");
  5340. *    ...
  5341. *
  5342. *   NOTES
  5343. *    None.
  5344. *
  5345. *   BUGS
  5346. *    No known bugs.
  5347. *
  5348. *   SEE ALSO
  5349. *    operator==(),operator!=(),operator>(),operator<=(),operator>=(),
  5350. *    Date/HeisWeekday()
  5351. *
  5352. ******************************************************************************/
  5353.  
  5354.   {
  5355.    return(HeisWeekday(this->day,this->month,this->year) < wd);
  5356.   }
  5357.  
  5358.  
  5359.  bool date::operator> (const Weekdays wd) const
  5360.  
  5361. /****** DateClass/date/operator>() ********************************************
  5362. *
  5363. *   NAME
  5364. *    operator>() -- Greater than operator for date object and weekday (V33)
  5365. *
  5366. *   SYNOPSIS
  5367. *    compare = ((*this) > wd);
  5368. *
  5369. *    bool operator> (const Weekdays wd) const;
  5370. *
  5371. *   FUNCTION
  5372. *    Compares if the date objects is greater than a weekday.
  5373. *
  5374. *   INPUTS
  5375. *    *this - date object
  5376. *    wd    - Weekday
  5377. *
  5378. *   RESULT
  5379. *    compare - Boolean result of the greater than compare operation
  5380. *
  5381. *   EXAMPLE
  5382. *    ...
  5383. *    if (d1 > wd)
  5384. *      printf(">\n");
  5385. *    else
  5386. *      printf("<=\n");
  5387. *    ...
  5388. *
  5389. *   NOTES
  5390. *    None.
  5391. *
  5392. *   BUGS
  5393. *    No known bugs.
  5394. *
  5395. *   SEE ALSO
  5396. *    operator==(),operator!=(),operator<(),operator<=(),operator>=(),
  5397. *    Date/HeisWeekday()
  5398. *
  5399. ******************************************************************************/
  5400.  
  5401.   {
  5402.    return(HeisWeekday(this->day,this->month,this->year) > wd);
  5403.   }
  5404.  
  5405.  
  5406.  bool date::operator<=(const Weekdays wd) const
  5407.  
  5408. /****** DateClass/date/operator<=() *******************************************
  5409. *
  5410. *   NAME
  5411. *    operator<=() -- Lower or equal operator for date obj. and weekday (V33)
  5412. *
  5413. *   SYNOPSIS
  5414. *    compare = ((*this) <= wd);
  5415. *
  5416. *    bool operator<=(const Weekdays wd) const;
  5417. *
  5418. *   FUNCTION
  5419. *    Compares if the date object is lower or equal to a weekday.
  5420. *
  5421. *   INPUTS
  5422. *    *this - date object
  5423. *    wd    - Weekday
  5424. *
  5425. *   RESULT
  5426. *    compare - Boolean result of the lower or equal compare operation
  5427. *
  5428. *   EXAMPLE
  5429. *    ...
  5430. *    if (d1 <= wd)
  5431. *      printf("<=\n");
  5432. *    else
  5433. *      printf(">\n");
  5434. *    ...
  5435. *
  5436. *   NOTES
  5437. *    None.
  5438. *
  5439. *   BUGS
  5440. *    No known bugs.
  5441. *
  5442. *   SEE ALSO
  5443. *    operator==(),operator!=(),operator<(),operator>(),operator>=(),
  5444. *    Date/HeisWeekday()
  5445. *
  5446. ******************************************************************************/
  5447.  
  5448.   {
  5449.    return(HeisWeekday(this->day,this->month,this->year) <= wd);
  5450.   }
  5451.  
  5452.  
  5453.  bool date::operator>=(const Weekdays wd) const
  5454.  
  5455. /****** DateClass/date/operator>=() *******************************************
  5456. *
  5457. *   NAME
  5458. *    operator>=() -- Greater or equal oper. for date obj. and weekday (V33)
  5459. *
  5460. *   SYNOPSIS
  5461. *    compare = ((*this) >= wd);
  5462. *
  5463. *    bool operator>=(const Weekdays wd) const;
  5464. *
  5465. *   FUNCTION
  5466. *    Compares if the date object is greater or equal to a weekday.
  5467. *
  5468. *   INPUTS
  5469. *    *this - date object
  5470. *    wd    - Weekday
  5471. *
  5472. *   RESULT
  5473. *    compare - Boolean result of the greater or equal compare operation
  5474. *
  5475. *   EXAMPLE
  5476. *    ...
  5477. *    if (d1 >= wd)
  5478. *      printf(">=\n");
  5479. *    else
  5480. *      printf("<\n");
  5481. *    ...
  5482. *
  5483. *   NOTES
  5484. *    None.
  5485. *
  5486. *   BUGS
  5487. *    No known bugs.
  5488. *
  5489. *   SEE ALSO
  5490. *    operator==(),operator!=(),operator<(),operator>(),operator<=(),
  5491. *    Date/HeisWeekday()
  5492. *
  5493. ******************************************************************************/
  5494.  
  5495.   {
  5496.    return(HeisWeekday(this->day,this->month,this->year) >= wd);
  5497.   }
  5498.  
  5499.  
  5500.  bool date::operator!() const
  5501.  
  5502. /****** DateClass/date/operator!() ********************************************
  5503. *
  5504. *   NAME
  5505. *    operator!() -- Leapyear operator for date object(V33)
  5506. *
  5507. *   SYNOPSIS
  5508. *    leapyear = !((*this));
  5509. *
  5510. *    bool operator!() const;
  5511. *
  5512. *   FUNCTION
  5513. *    Checks if the year of the date object is a leap year.
  5514. *
  5515. *   INPUTS
  5516. *    *this - date object
  5517. *
  5518. *
  5519. *   RESULT
  5520. *    leapyear - Boolean, TRUE if the year of the date object is a leapyear,
  5521. *        FALSE if it is a normal year.
  5522. *
  5523. *   EXAMPLE
  5524. *    ...
  5525. *    if (!d)
  5526. *      printf("leap year\n");
  5527. *    else
  5528. *      printf("normal year\n");
  5529. *    ...
  5530. *
  5531. *   NOTES
  5532. *    None.
  5533. *
  5534. *   BUGS
  5535. *    No known bugs.
  5536. *
  5537. *   SEE ALSO
  5538. *    Date/HeisLeapYear()
  5539. *
  5540. ******************************************************************************/
  5541.  
  5542.   {
  5543.    return(HeisLeapYear(this->year));
  5544.   }
  5545.  
  5546.  
  5547.  dateduration date::operator-(const date &d) const
  5548.  
  5549. /****** DateClass/date/operator-() ********************************************
  5550. *
  5551. *   NAME
  5552. *    operator-() -- Sub operator for date objects (V33)
  5553. *
  5554. *   SYNOPSIS
  5555. *    dd = (*this) - d;
  5556. *
  5557. *    dateduration operator-(const date &d) const;
  5558. *
  5559. *   FUNCTION
  5560. *    Subtract date object 2 from date object 1 to a new dateduration object.
  5561. *
  5562. *   INPUTS
  5563. *    *this - date object
  5564. *    d     - date object
  5565. *
  5566. *   RESULT
  5567. *    dd - New dateduration object
  5568. *
  5569. *   EXAMPLE
  5570. *    ...
  5571. *    dd = d1 - d2;
  5572. *    ...
  5573. *
  5574. *   NOTES
  5575. *    None.
  5576. *
  5577. *   BUGS
  5578. *    No known bugs.
  5579. *
  5580. *   SEE ALSO
  5581. *    operator+(),operator-(),dateduration(),Date/HeisDayDiff()
  5582. *
  5583. ******************************************************************************/
  5584.  
  5585.   {
  5586.    long days = HeisDayDiff(this->day,this->month,this->year,d.day,d.month,d.year);
  5587.  
  5588.    if (days < 0)
  5589.      days = -days;
  5590.    return(dateduration(days));
  5591.   }
  5592.  
  5593.  
  5594.  date date::operator+(const dateduration &dd) const
  5595.  
  5596. /****** DateClass/date/operator+() ********************************************
  5597. *
  5598. *   NAME
  5599. *    operator+() -- Add operator for date and dateduration objects (V33)
  5600. *
  5601. *   SYNOPSIS
  5602. *    d = (*this) + dd;
  5603. *
  5604. *    date operator+(const dateduration &dd) const;
  5605. *
  5606. *   FUNCTION
  5607. *    Add a date object and a dateduration object to a new date object.
  5608. *
  5609. *   INPUTS
  5610. *    *this - date object
  5611. *    dd    - dateduration object
  5612. *
  5613. *   RESULT
  5614. *    d - New date object
  5615. *
  5616. *   EXAMPLE
  5617. *    ...
  5618. *    d1 = d2 + dd;
  5619. *    ...
  5620. *
  5621. *   NOTES
  5622. *    None.
  5623. *
  5624. *   BUGS
  5625. *    The dateduration may not be longer (in days) than an integer value!
  5626. *
  5627. *   SEE ALSO
  5628. *    operator-(),operator+=(),operator-=(),date(),dateduration/getindays(),
  5629. *    Date/HeisDiffDate()
  5630. *
  5631. ******************************************************************************/
  5632.  
  5633.   {
  5634.    unsigned short day,month;
  5635.    int year;
  5636.  
  5637.    HeisDiffDate(this->day,this->month,this->year,(int)dd.getindays(),day,month,year);
  5638.    return(date(day,month,year));
  5639.   }
  5640.  
  5641.  
  5642.  date date::operator-(const dateduration &dd) const
  5643.  
  5644. /****** DateClass/date/operator-() ********************************************
  5645. *
  5646. *   NAME
  5647. *    operator-() -- Sub operator for date and dateduration objects (V33)
  5648. *
  5649. *   SYNOPSIS
  5650. *    d = (*this) - dd;
  5651. *
  5652. *    date operator-(const dateduration &dd) const;
  5653. *
  5654. *   FUNCTION
  5655. *    Subtract a dateduration object from a date object to a new date object.
  5656. *
  5657. *   INPUTS
  5658. *    *this - date object
  5659. *    dd    - dateduration object
  5660. *
  5661. *   RESULT
  5662. *    d     - New date object
  5663. *
  5664. *   EXAMPLE
  5665. *    ...
  5666. *    d1 = d2 - dd;
  5667. *    ...
  5668. *
  5669. *   NOTES
  5670. *    None.
  5671. *
  5672. *   BUGS
  5673. *    The dateduration may not be longer (in days) than an integer value!
  5674. *
  5675. *   SEE ALSO
  5676. *    operator+(),operator+=(),operator-=(),date(),dateduration/getindays(),
  5677. *    Date/HeisDiffDate()
  5678. *
  5679. ******************************************************************************/
  5680.  
  5681.   {
  5682.    unsigned short day,month;
  5683.    int year;
  5684.  
  5685.    HeisDiffDate(this->day,this->month,this->year,(int)-dd.getindays(),day,month,year);
  5686.    return(date(day,month,year));
  5687.   }
  5688.  
  5689.  
  5690.  const date &date::operator+=(const dateduration &dd)
  5691.  
  5692. /****** DateClass/date/operator+=() *******************************************
  5693. *
  5694. *   NAME
  5695. *    operator+=() -- Add to operator for date and dateduration objects (V33)
  5696. *
  5697. *   SYNOPSIS
  5698. *    (*this) += dd;
  5699. *
  5700. *    const date &operator+=(const dateduration &dd);
  5701. *
  5702. *   FUNCTION
  5703. *    Add a dateduration object to a date object.
  5704. *
  5705. *   INPUTS
  5706. *    *this - date object
  5707. *    dd    - dateduration object
  5708. *
  5709. *   RESULT
  5710. *    *this - Modified date object
  5711. *
  5712. *   EXAMPLE
  5713. *    ...
  5714. *    d += dd;
  5715. *    ...
  5716. *
  5717. *   NOTES
  5718. *    None.
  5719. *
  5720. *   BUGS
  5721. *    The dateduration may not be longer (in days) than an integer value!
  5722. *
  5723. *   SEE ALSO
  5724. *    operator+(),operator-(),operator-=(),dateduration/getindays(),
  5725. *    Date/HeisDiffDate()
  5726. *
  5727. ******************************************************************************/
  5728.  
  5729.   {
  5730.    HeisDiffDate(this->day,this->month,this->year,(int)dd.getindays(),this->day,this->month,this->year);
  5731.    return(*this);
  5732.   }
  5733.  
  5734.  
  5735.  const date &date::operator-=(const dateduration &dd)
  5736.  
  5737. /****** DateClass/date/operator-=() *******************************************
  5738. *
  5739. *   NAME
  5740. *    operator-=() -- Sub from operator for date and dateduration objs (V33)
  5741. *
  5742. *   SYNOPSIS
  5743. *    (*this) -= dd;
  5744. *
  5745. *    const date &operator-=(const dateduration &dd);
  5746. *
  5747. *   FUNCTION
  5748. *    Subtract a dateduration object from a date object.
  5749. *
  5750. *   INPUTS
  5751. *    *this - date object
  5752. *    dd    - dateduration object
  5753. *
  5754. *   RESULT
  5755. *    *this - Modified date object
  5756. *
  5757. *   EXAMPLE
  5758. *    ...
  5759. *    d -= dd;
  5760. *    ...
  5761. *
  5762. *   NOTES
  5763. *    None.
  5764. *
  5765. *   BUGS
  5766. *    The dateduration may not be longer (in days) than an integer value!
  5767. *
  5768. *   SEE ALSO
  5769. *    operator+(),operator-(),operator+=(),dateduration/getindays(),
  5770. *    Date/HeisDiffDate()
  5771. *
  5772. ******************************************************************************/
  5773.  
  5774.   {
  5775.    HeisDiffDate(this->day,this->month,this->year,(int)-dd.getindays(),this->day,this->month,this->year);
  5776.    return(*this);
  5777.   }
  5778.  
  5779.  
  5780.  date date::operator+(const Weekdays wd) const
  5781.  
  5782. /****** DateClass/date/operator+() ********************************************
  5783. *
  5784. *   NAME
  5785. *    operator+() -- Add operator for date object and weekday (V33)
  5786. *
  5787. *   SYNOPSIS
  5788. *    d = (*this) + wd;
  5789. *
  5790. *    date operator+(const Weekdays wd) const;
  5791. *
  5792. *   FUNCTION
  5793. *    Gives you the next date, that is the specified weekday (could be the
  5794. *    same date!).
  5795. *
  5796. *   INPUTS
  5797. *    *this - date object
  5798. *    wd    - Weekday
  5799. *
  5800. *   RESULT
  5801. *    d - New date object
  5802. *
  5803. *   EXAMPLE
  5804. *    ...
  5805. *    d1 = d2 + wd;
  5806. *    ...
  5807. *
  5808. *   NOTES
  5809. *    None.
  5810. *
  5811. *   BUGS
  5812. *    No known bugs.
  5813. *
  5814. *   SEE ALSO
  5815. *    operator-(),operator+=(),operator-=(),date(),
  5816. *    Date/HeisDaysAfterWeekday(),Date/HeisDiffDate()
  5817. *
  5818. ******************************************************************************/
  5819.  
  5820.   {
  5821.    unsigned short day,month,days=HeisDaysAfterWeekday(this->day,this->month,this->year,wd);
  5822.    int year;
  5823.  
  5824.    HeisDiffDate(this->day,this->month,this->year,days,day,month,year);
  5825.    return(date(day,month,year));
  5826.   }
  5827.  
  5828.  
  5829.  date date::operator-(const Weekdays wd) const
  5830.  
  5831. /****** DateClass/date/operator-() ********************************************
  5832. *
  5833. *   NAME
  5834. *    operator-() -- Sub operator for date object and weekday (V33)
  5835. *
  5836. *   SYNOPSIS
  5837. *    d = (*this) - wd;
  5838. *
  5839. *    date operator-(const Weekdays wd) const;
  5840. *
  5841. *   FUNCTION
  5842. *    Gives you the last date, that is the specified weekday (could be the
  5843. *    same date!).
  5844. *
  5845. *   INPUTS
  5846. *    *this - date object
  5847. *    wd    - Weekday
  5848. *
  5849. *   RESULT
  5850. *    d - New date object
  5851. *
  5852. *   EXAMPLE
  5853. *    ...
  5854. *    d1 = d2 - wd;
  5855. *    ...
  5856. *
  5857. *   NOTES
  5858. *    None.
  5859. *
  5860. *   BUGS
  5861. *    No known bugs.
  5862. *
  5863. *   SEE ALSO
  5864. *    operator+(),operator+=(),operator-=(),date(),
  5865. *    Date/HeisDaysBeforeWeekday(),Date/HeisDiffDate()
  5866. *
  5867. ******************************************************************************/
  5868.  
  5869.   {
  5870.    unsigned short day,month,days=HeisDaysBeforeWeekday(this->day,this->month,this->year,wd);
  5871.    int year;
  5872.  
  5873.    HeisDiffDate(this->day,this->month,this->year,-days,day,month,year);
  5874.    return(date(day,month,year));
  5875.   }
  5876.  
  5877.  
  5878.  const date &date::operator+=(const Weekdays wd)
  5879.  
  5880. /****** DateClass/date/operator+=() *******************************************
  5881. *
  5882. *   NAME
  5883. *    operator+=() -- Add to operator for date object and weekday (V33)
  5884. *
  5885. *   SYNOPSIS
  5886. *    (*this) += wd;
  5887. *
  5888. *    const date &operator+=(const Weekdays wd);
  5889. *
  5890. *   FUNCTION
  5891. *    Corrects the date object to the next date that is the specified weekday
  5892. *    (could be the same date!).
  5893. *
  5894. *   INPUTS
  5895. *    *this - date object
  5896. *    wd    - Weekday
  5897. *
  5898. *   RESULT
  5899. *    *this - Modified date object
  5900. *
  5901. *   EXAMPLE
  5902. *    ...
  5903. *    d += wd;
  5904. *    ...
  5905. *
  5906. *   NOTES
  5907. *    None.
  5908. *
  5909. *   BUGS
  5910. *    No known bugs.
  5911. *
  5912. *   SEE ALSO
  5913. *    operator+(),operator-(),operator-=(),Date/HeisDaysAfterWeekday(),
  5914. *    Date/HeisDiffDate()
  5915. *
  5916. ******************************************************************************/
  5917.  
  5918.   {
  5919.    unsigned days=HeisDaysAfterWeekday(this->day,this->month,this->year,wd);
  5920.  
  5921.    HeisDiffDate(this->day,this->month,this->year,days,this->day,this->month,this->year);
  5922.    return(*this);
  5923.   }
  5924.  
  5925.  
  5926.  const date &date::operator-=(const Weekdays wd)
  5927.  
  5928. /****** DateClass/date/operator-=() *******************************************
  5929. *
  5930. *   NAME
  5931. *    operator-=() -- Sub from operator for date object and weekday (V33)
  5932. *
  5933. *   SYNOPSIS
  5934. *    (*this) -= wd;
  5935. *
  5936. *    const date &operator-=(const Weekdays wd);
  5937. *
  5938. *   FUNCTION
  5939. *    Corrects the date object to the last date that is the specified weekday
  5940. *    (could be the same date!).
  5941. *
  5942. *   INPUTS
  5943. *    *this - date object
  5944. *    wd    - Weekday
  5945. *
  5946. *   RESULT
  5947. *    *this - Modified date object
  5948. *
  5949. *   EXAMPLE
  5950. *    ...
  5951. *    d -= wd;
  5952. *    ...
  5953. *
  5954. *   NOTES
  5955. *    None.
  5956. *
  5957. *   BUGS
  5958. *    No known bugs.
  5959. *
  5960. *   SEE ALSO
  5961. *    operator+(),operator-(),operator+=(),Date/HeisDaysBeforeWeekday(),
  5962. *    Date/HeisDiffDate()
  5963. *
  5964. ******************************************************************************/
  5965.  
  5966.   {
  5967.    unsigned days=HeisDaysBeforeWeekday(this->day,this->month,this->year,wd);
  5968.  
  5969.    HeisDiffDate(this->day,this->month,this->year,-days,this->day,this->month,this->year);
  5970.    return(*this);
  5971.   }
  5972.  
  5973.  
  5974.  date date::operator++()
  5975.  
  5976. /****** DateClass/date/operator++() *******************************************
  5977. *
  5978. *   NAME
  5979. *    operator++() -- Increment operator for date object (V33)
  5980. *
  5981. *   SYNOPSIS
  5982. *    d++;
  5983. *
  5984. *    date operator++();
  5985. *
  5986. *   FUNCTION
  5987. *    Increments the date object by one day.
  5988. *
  5989. *   INPUTS
  5990. *    *this - date object
  5991. *
  5992. *   RESULT
  5993. *    *this - Modified date object
  5994. *
  5995. *   EXAMPLE
  5996. *    ...
  5997. *    d++;
  5998. *    ...
  5999. *
  6000. *   NOTES
  6001. *    None.
  6002. *
  6003. *   BUGS
  6004. *    No known bugs.
  6005. *
  6006. *   SEE ALSO
  6007. *    operator++(int),operator--(),operator--(int),Date/HeisDiffDate()
  6008. *
  6009. ******************************************************************************/
  6010.  
  6011.   {
  6012.    date tmp = *this;
  6013.  
  6014.    HeisDiffDate(this->day,this->month,this->year,1,this->day,this->month,this->year);
  6015.    return(tmp);
  6016.   }
  6017.  
  6018.  
  6019.  date date::operator++(int)
  6020.  
  6021. /****** DateClass/date/operator++(int) ****************************************
  6022. *
  6023. *   NAME
  6024. *    operator++(int) -- Increment operator for date object (V33)
  6025. *
  6026. *   SYNOPSIS
  6027. *    ++d;
  6028. *
  6029. *    date operator++(int);
  6030. *
  6031. *   FUNCTION
  6032. *    Increments the date object by one day.
  6033. *
  6034. *   INPUTS
  6035. *    *this - date object
  6036. *
  6037. *   RESULT
  6038. *    *this - Modified date object
  6039. *
  6040. *   EXAMPLE
  6041. *    ...
  6042. *    ++d;
  6043. *    ...
  6044. *
  6045. *   NOTES
  6046. *    None.
  6047. *
  6048. *   BUGS
  6049. *    No known bugs.
  6050. *
  6051. *   SEE ALSO
  6052. *    operator++(),operator--(),operator--(int),Date/HeisDiffDate()
  6053. *
  6054. ******************************************************************************/
  6055.  
  6056.   {
  6057.    HeisDiffDate(this->day,this->month,this->year,1,this->day,this->month,this->year);
  6058.    return(*this);
  6059.   }
  6060.  
  6061.  
  6062.  date date::operator--()
  6063.  
  6064. /****** DateClass/date/operator--() *******************************************
  6065. *
  6066. *   NAME
  6067. *    operator--() -- Decrement operator for date object (V33)
  6068. *
  6069. *   SYNOPSIS
  6070. *    d--;
  6071. *
  6072. *    date operator--();
  6073. *
  6074. *   FUNCTION
  6075. *    Decrements the date object by one day.
  6076. *
  6077. *   INPUTS
  6078. *    *this - date object
  6079. *
  6080. *   RESULT
  6081. *    *this - Modified date object
  6082. *
  6083. *   EXAMPLE
  6084. *    ...
  6085. *    dd--;
  6086. *    ...
  6087. *
  6088. *   NOTES
  6089. *    None.
  6090. *
  6091. *   BUGS
  6092. *    No known bugs.
  6093. *
  6094. *   SEE ALSO
  6095. *    operator++(),operator++(int),operator--(int),Date/HeisDiffDate()
  6096. *
  6097. ******************************************************************************/
  6098.  
  6099.   {
  6100.    date tmp = *this;
  6101.  
  6102.    HeisDiffDate(this->day,this->month,this->year,-1,this->day,this->month,this->year);
  6103.    return(tmp);
  6104.   }
  6105.  
  6106.  
  6107.  date date::operator--(int)
  6108.  
  6109. /****** DateClass/date/operator--(int) ****************************************
  6110. *
  6111. *   NAME
  6112. *    operator--(int) -- Decrement operator for date object (V33)
  6113. *
  6114. *   SYNOPSIS
  6115. *    --d;
  6116. *
  6117. *    date operator--(int);
  6118. *
  6119. *   FUNCTION
  6120. *    Decrements the date object by one day.
  6121. *
  6122. *   INPUTS
  6123. *    *this - date object
  6124. *
  6125. *   RESULT
  6126. *    *this - Modified date object
  6127. *
  6128. *   EXAMPLE
  6129. *    ...
  6130. *    --d;
  6131. *    ...
  6132. *
  6133. *   NOTES
  6134. *    None.
  6135. *
  6136. *   BUGS
  6137. *    No known bugs.
  6138. *
  6139. *   SEE ALSO
  6140. *    operator++(),operator++(int),operator--(),Date/HeisDiffDate()
  6141. *
  6142. ******************************************************************************/
  6143.  
  6144.   {
  6145.    HeisDiffDate(this->day,this->month,this->year,-1,this->day,this->month,this->year);
  6146.    return(*this);
  6147.   }
  6148.  
  6149.  
  6150.  unsigned short date::getday(void) const
  6151.  
  6152. /****** DateClass/date/getday() ***********************************************
  6153. *
  6154. *   NAME
  6155. *    getday() -- Get day of date object (V33)
  6156. *
  6157. *   SYNOPSIS
  6158. *    day = (*this).getday();
  6159. *
  6160. *    unsigned short getday(void) const;
  6161. *
  6162. *   FUNCTION
  6163. *    Get the day from the date object.
  6164. *
  6165. *   INPUTS
  6166. *    *this - date object
  6167. *
  6168. *   RESULT
  6169. *    day - Day of the date object
  6170. *
  6171. *   EXAMPLE
  6172. *    ...
  6173. *    day = d.getday();
  6174. *    ...
  6175. *
  6176. *   NOTES
  6177. *    None.
  6178. *
  6179. *   BUGS
  6180. *    No known bugs.
  6181. *
  6182. *   SEE ALSO
  6183. *    getmonth(),getyear(),getweek(),getweekday(),getjd(),getmjd(),
  6184. *    getscaliger()
  6185. *
  6186. ******************************************************************************/
  6187.  
  6188.   {
  6189.    return(this->day);
  6190.   }
  6191.  
  6192.  
  6193.  unsigned short date::getmonth(void) const
  6194.  
  6195. /****** DateClass/date/getmonth() *********************************************
  6196. *
  6197. *   NAME
  6198. *    getmonth() -- Get month of date object (V33)
  6199. *
  6200. *   SYNOPSIS
  6201. *    month = (*this).getmonth();
  6202. *
  6203. *    unsigned short getmonth(void) const;
  6204. *
  6205. *   FUNCTION
  6206. *    Get the month from the date object.
  6207. *
  6208. *   INPUTS
  6209. *    *this - date object
  6210. *
  6211. *   RESULT
  6212. *    month - Month of the date object
  6213. *
  6214. *   EXAMPLE
  6215. *    ...
  6216. *    month = d.getmonth();
  6217. *    ...
  6218. *
  6219. *   NOTES
  6220. *    None.
  6221. *
  6222. *   BUGS
  6223. *    No known bugs.
  6224. *
  6225. *   SEE ALSO
  6226. *    getday(),getyear(),getweek(),getweekday(),getjd(),getmjd(),
  6227. *    getscaliger()
  6228. *
  6229. ******************************************************************************/
  6230.  
  6231.   {
  6232.    return(this->month);
  6233.   }
  6234.  
  6235.  
  6236.  int date::getyear(void) const
  6237.  
  6238. /****** DateClass/date/getyear() **********************************************
  6239. *
  6240. *   NAME
  6241. *    getyear() -- Get year of date object (V33)
  6242. *
  6243. *   SYNOPSIS
  6244. *    year = (*this).getyear();
  6245. *
  6246. *    int getyear(void) const;
  6247. *
  6248. *   FUNCTION
  6249. *    Get the year from the date object.
  6250. *
  6251. *   INPUTS
  6252. *    *this - date object
  6253. *
  6254. *   RESULT
  6255. *    year - Year of the date object
  6256. *
  6257. *   EXAMPLE
  6258. *    ...
  6259. *    year = d.getyear();
  6260. *    ...
  6261. *
  6262. *   NOTES
  6263. *    None.
  6264. *
  6265. *   BUGS
  6266. *    No known bugs.
  6267. *
  6268. *   SEE ALSO
  6269. *    getday(),getmonth(),getweek(),getweekday(),getjd(),getmjd(),
  6270. *    getscaliger()
  6271. *
  6272. ******************************************************************************/
  6273.  
  6274.   {
  6275.    return(this->year);
  6276.   }
  6277.  
  6278.  
  6279.  unsigned short date::getweek(void) const
  6280.  
  6281. /****** DateClass/date/getweek() **********************************************
  6282. *
  6283. *   NAME
  6284. *    getweek() -- Get week of date object (V33)
  6285. *
  6286. *   SYNOPSIS
  6287. *    week = (*this).getweek();
  6288. *
  6289. *    unsigned short getweek(void) const;
  6290. *
  6291. *   FUNCTION
  6292. *    Get the week from the date object.
  6293. *
  6294. *   INPUTS
  6295. *    *this - date object
  6296. *
  6297. *   RESULT
  6298. *    week - Week of the date object
  6299. *
  6300. *   EXAMPLE
  6301. *    ...
  6302. *    week = d.getweek();
  6303. *    ...
  6304. *
  6305. *   NOTES
  6306. *    None.
  6307. *
  6308. *   BUGS
  6309. *    No known bugs.
  6310. *
  6311. *   SEE ALSO
  6312. *    getday(),getmonth(),getyear(),getweekday(),getjd(),getmjd(),
  6313. *    getscaliger(),Date/HeisWeek()
  6314. *
  6315. ******************************************************************************/
  6316.  
  6317.   {
  6318.    return(HeisWeek(this->day,this->month,this->year));
  6319.   }
  6320.  
  6321.  
  6322.  Weekdays date::getweekday(void) const
  6323.  
  6324. /****** DateClass/date/getweekday() *******************************************
  6325. *
  6326. *   NAME
  6327. *    getweekday() -- Get weekday of date object (V33)
  6328. *
  6329. *   SYNOPSIS
  6330. *    weekday = (*this).getweekday();
  6331. *
  6332. *    Weekdays getweekday(void) const;
  6333. *
  6334. *   FUNCTION
  6335. *    Get the weekday from the date object.
  6336. *
  6337. *   INPUTS
  6338. *    *this - date object
  6339. *
  6340. *   RESULT
  6341. *    weekday - Weekday of the date object
  6342. *
  6343. *   EXAMPLE
  6344. *    ...
  6345. *    wd = d.getweekday();
  6346. *    ...
  6347. *
  6348. *   NOTES
  6349. *    None.
  6350. *
  6351. *   BUGS
  6352. *    No known bugs.
  6353. *
  6354. *   SEE ALSO
  6355. *    getday(),getmonth(),getyear(),getweek(),getjd(),getmjd(),
  6356. *    getscaliger(),Date/HeisWeekday()
  6357. *
  6358. ******************************************************************************/
  6359.  
  6360.   {
  6361.    return(HeisWeekday(this->day,this->month,this->year));
  6362.   }
  6363.  
  6364.  
  6365.  unsigned long date::getjd(void) const
  6366.  
  6367. /****** DateClass/date/getjd() ************************************************
  6368. *
  6369. *   NAME
  6370. *    getjd() -- Get date in JD format from date object (V33)
  6371. *
  6372. *   SYNOPSIS
  6373. *    jd = (*this).getjd();
  6374. *
  6375. *    unsigned long getjd(void) const;
  6376. *
  6377. *   FUNCTION
  6378. *    Get the date from the date object in JD format.
  6379. *
  6380. *   INPUTS
  6381. *    *this - date object
  6382. *
  6383. *   RESULT
  6384. *    jd - Date of the date object in JD format
  6385. *
  6386. *   EXAMPLE
  6387. *    ...
  6388. *    jd = d.getjd();
  6389. *    ...
  6390. *
  6391. *   NOTES
  6392. *    None.
  6393. *
  6394. *   BUGS
  6395. *    No known bugs.
  6396. *
  6397. *   SEE ALSO
  6398. *    getday(),getmonth(),getyear(),getweek(),getweekday(),getmjd(),
  6399. *    getscaliger(),Date/HeisToJD()
  6400. *
  6401. ******************************************************************************/
  6402.  
  6403.   {
  6404.    return(HeisToJD(this->day,this->month,this->year));
  6405.   }
  6406.  
  6407.  
  6408.  unsigned long date::getmjd(void) const
  6409.  
  6410. /****** DateClass/date/getmjd() ***********************************************
  6411. *
  6412. *   NAME
  6413. *    getmjd() -- Get date in MJD format from date object (V33)
  6414. *
  6415. *   SYNOPSIS
  6416. *    mjd = (*this).getmjd();
  6417. *
  6418. *    unsigned long getmjd(void) const;
  6419. *
  6420. *   FUNCTION
  6421. *    Get the date from the date object in MJD format.
  6422. *
  6423. *   INPUTS
  6424. *    *this - date object
  6425. *
  6426. *   RESULT
  6427. *    mjd - Date of the date object in MJD format
  6428. *
  6429. *   EXAMPLE
  6430. *    ...
  6431. *    mjd = d.getmjd();
  6432. *    ...
  6433. *
  6434. *   NOTES
  6435. *    None.
  6436. *
  6437. *   BUGS
  6438. *    No known bugs.
  6439. *
  6440. *   SEE ALSO
  6441. *    getday(),getmonth(),getyear(),getweek(),getweekday(),getjd(),
  6442. *    getscaliger(),Date/JDtoMJD(),Date/HeisToJD()
  6443. *
  6444. ******************************************************************************/
  6445.  
  6446.   {
  6447.    return(JDtoMJD(HeisToJD(this->day,this->month,this->year)));
  6448.   }
  6449.  
  6450.  
  6451.  unsigned int date::getscaliger(void) const
  6452.  
  6453. /****** DateClass/date/getscaliger() ******************************************
  6454. *
  6455. *   NAME
  6456. *    getscaliger() -- Get year in Scaliger format from date object (V33)
  6457. *
  6458. *   SYNOPSIS
  6459. *    scaliger = (*this).getscaliger();
  6460. *
  6461. *    unsigned int getscaliger(void) const;
  6462. *
  6463. *   FUNCTION
  6464. *    Get the year of the date object in Scaliger format.
  6465. *
  6466. *   INPUTS
  6467. *    *this - date object
  6468. *
  6469. *   RESULT
  6470. *    scaliger - Year of the date object in Scaliger format
  6471. *
  6472. *   EXAMPLE
  6473. *    ...
  6474. *    syear = d.getscaliger();
  6475. *    ...
  6476. *
  6477. *   NOTES
  6478. *    None.
  6479. *
  6480. *   BUGS
  6481. *    No known bugs.
  6482. *
  6483. *   SEE ALSO
  6484. *    getday(),getmonth(),getyear(),getweek(),getweekday(),getjd(),getmjd(),
  6485. *    Date/HYearToScaliger()
  6486. *
  6487. ******************************************************************************/
  6488.  
  6489.   {
  6490.    return(HYearToScaliger(this->year));
  6491.   }
  6492.  
  6493.  
  6494.  unsigned short date::getmoonage(void) const
  6495.  
  6496. /****** DateClass/date/getmoonage() *******************************************
  6497. *
  6498. *   NAME
  6499. *    getmoonage() -- Returns the age of the moon (V33)
  6500. *
  6501. *   SYNOPSIS
  6502. *    ep = (*this).getmoonage();
  6503. *
  6504. *    unsigned short getmoonage(void) const;
  6505. *
  6506. *   FUNCTION
  6507. *    Returns the age of the moon on a specified date.
  6508. *
  6509. *   INPUTS
  6510. *    *this - date object
  6511. *
  6512. *   RESULT
  6513. *    ep - The age of the moon on the specified date.
  6514. *
  6515. *   EXAMPLE
  6516. *    ...
  6517. *    ep = d.getmoonage();
  6518. *    ...
  6519. *
  6520. *   NOTES
  6521. *    Use this only for 1582 to 4100!
  6522. *    This is only a experimental version!
  6523. *
  6524. *   BUGS
  6525. *    Unknown
  6526. *
  6527. *   SEE ALSO
  6528. *    date/GregorianMoonAge()
  6529. *
  6530. ******************************************************************************/
  6531.  
  6532.   {
  6533.    return(GregorianMoonAge(this->day,this->month,this->year));
  6534.   }
  6535.  
  6536.  
  6537.  date date::getmoonphase(const MoonPhases phase) const
  6538.  
  6539. /****** DateClass/date/getmoonphase() *****************************************
  6540. *
  6541. *   NAME
  6542. *    getmoonphase() -- Searches for the next moon phase (V33)
  6543. *
  6544. *   SYNOPSIS
  6545. *    date = (*this).getmoonphase(phase);
  6546. *
  6547. *    date getmoonphase(const MoonPhases phase) const;
  6548. *
  6549. *   FUNCTION
  6550. *    Returns the next moon phase you are searching for after
  6551. *    a specified date.
  6552. *
  6553. *   INPUTS
  6554. *    *this - date object
  6555. *
  6556. *   RESULT
  6557. *    date - The date on which the moon phase was found.
  6558. *
  6559. *   EXAMPLE
  6560. *    ...
  6561. *    date = d.getmoonphase(FullMoon);
  6562. *    ...
  6563. *
  6564. *   NOTES
  6565. *    The range of this function is unknown to me!
  6566. *    So use it only from 1583 to 2500.
  6567. *    This is only an experimental version!
  6568. *
  6569. *   BUGS
  6570. *    Unknown
  6571. *
  6572. *   SEE ALSO
  6573. *    date/GregorianMoonPhase(),date/JDToHeis(),date()
  6574. *
  6575. ******************************************************************************/
  6576.  
  6577.   {
  6578.    unsigned short day,month;
  6579.    int year;
  6580.  
  6581.    JDToHeis(GregorianMoonPhase(this->day,this->month,this->year,phase),day,month,year);
  6582.    return(date(day,month,year));
  6583.   }
  6584.  
  6585.  /* ----------------------------------------------------------------------- */
  6586.  
  6587.  date Easter(const int year)
  6588.  
  6589. /****** DateClass/Easter() ****************************************************
  6590. *
  6591. *   NAME
  6592. *    Easter() -- Returns the date of Easter in a year (V33)
  6593. *
  6594. *   SYNOPSIS
  6595. *    date = Easter(year);
  6596. *
  6597. *    date Easter(const int year);
  6598. *
  6599. *   FUNCTION
  6600. *    Returns the date of Easter for a specified year.
  6601. *
  6602. *   INPUTS
  6603. *    year - Easter is calculated for this year
  6604. *
  6605. *   RESULT
  6606. *    date - Complete date of Easter Sunday
  6607. *
  6608. *   EXAMPLE
  6609. *    ...
  6610. *    date = Easter(1995);
  6611. *    ...
  6612. *
  6613. *   NOTES
  6614. *    Use this only for 31 to 2099!
  6615. *
  6616. *   BUGS
  6617. *    Unknown.
  6618. *
  6619. *   SEE ALSO
  6620. *    date/HeisEaster(),date
  6621. *
  6622. ******************************************************************************/
  6623.  
  6624.   {
  6625.    unsigned short day,month;
  6626.  
  6627.    HeisEaster(year,day,month);
  6628.    return(date(day,month,year));
  6629.   }
  6630.  
  6631.  /* ----------------------------------------------------------------------- */
  6632.