aboutsummaryrefslogtreecommitdiffstats
path: root/lib/psitime.h
diff options
context:
space:
mode:
authorFritz Elfert <felfert@to.com>2000-08-07 23:42:40 +0000
committerFritz Elfert <felfert@to.com>2000-08-07 23:42:40 +0000
commit68d5fd192fee358ad195c32b47333f8f87ae13f2 (patch)
tree59f865b9679830a006c5c35fb13dcf8f81b85099 /lib/psitime.h
parent50dee0db8d5117ed3b9691140ceb02d8aac292d1 (diff)
downloadplptools-68d5fd192fee358ad195c32b47333f8f87ae13f2.tar.gz
plptools-68d5fd192fee358ad195c32b47333f8f87ae13f2.tar.bz2
plptools-68d5fd192fee358ad195c32b47333f8f87ae13f2.zip
General cleanup:
- Corrected some operators of bufferArray - Added more constructors to PsiTime - Added one more fallback for Timezone calculation in PsiTime - Use PsiTime in rfsv - Moved some common methods from rfsv16/32 to rfsv - Added more kdoc comments. - Made interface more robust (added const whereever possible, changed pointer arguments to references)
Diffstat (limited to 'lib/psitime.h')
-rw-r--r--lib/psitime.h68
1 files changed, 61 insertions, 7 deletions
diff --git a/lib/psitime.h b/lib/psitime.h
index 6946fc1..9755473 100644
--- a/lib/psitime.h
+++ b/lib/psitime.h
@@ -89,25 +89,48 @@ typedef struct psi_timezone_t {
* <em>not</em> set, a fallback using the environment
* variable <em>PSI_TZ</em> is provided. Users should
* set this variable to the offset of their time zone
- * in seconds.
+ * in seconds. If <em>PSI_TZ</em> is net set, a second
+ * fallback uses the local machine's setup, which assumes
+ * that both Psion and local machine have the same
+ * time zone and daylight settings.
*/
class PsiTime {
public:
/**
* Contructs a new instance.
*
+ * @param _utv A Unix time value for initialization.
+ * @param _utz A Unix timezone for initialization.
+ */
+ PsiTime(struct timeval *_utv, struct timezone *_utz = 0L);
+
+ /**
+ * Contructs a new instance.
+ *
+ * @param time A Unix time value for initialization.
+ */
+ PsiTime(time_t time);
+
+ /**
+ * Contructs a new instance.
+ *
* @param _ptv A Psion time value for initialization.
* @param _ptz A Psion timezone for initialization.
*/
- PsiTime(psi_timeval *_ptv = 0L, psi_timezone *_ptz = 0L);
+ PsiTime(psi_timeval *_ptv, psi_timezone *_ptz = 0L);
/**
- * Constructs a new instance.
- *
- * @param _utv A Unix time value for initialization.
- * @param _utz A Unix timezone for initialization.
+ * Contructs a new instance.
+ *
+ * @param _ptvHi The high 16 bits of a Psion time value for initialization.
+ * @param _ptvLo The low 16 bits of a Psion time value for initialization.
*/
- PsiTime(struct timeval *_utv = 0L, struct timezone *_utz = 0L);
+ PsiTime(const unsigned long _ptvHi, const unsigned long _ptvLo);
+
+ /**
+ * Constructs a new instance, initializing to now.
+ */
+ PsiTime(void);
/**
* Destroys the instance.
@@ -122,6 +145,14 @@ public:
void setPsiTime(psi_timeval *_ptv);
/**
+ * Modifies the value of this instance.
+ *
+ * @param _ptvHi The high 32 bits of a Psion time.
+ * @param _ptvLo The low 32 bits of a Psion time.
+ */
+ void setPsiTime(const unsigned long _ptvHi, const unsigned long _ptvLo);
+
+ /**
* Sets the Psion time zone of this instance.
*
* @param _ptz The new Psion time zone.
@@ -136,6 +167,13 @@ public:
void setUnixTime(struct timeval *_utv);
/**
+ * Sets the value of this instance.
+ *
+ * @param _utv The new Unix time representation.
+ */
+ void setUnixTime(time_t time);
+
+ /**
* Sets the value of this instance to the
* current time of the Unix machine.
*/
@@ -166,6 +204,22 @@ public:
psi_timeval &getPsiTimeval(void);
/**
+ * Retrieves the instance's current value
+ * in Psion time format, high 32 bits.
+ *
+ * @returns The instance's current time as lower 32 bits of a Psion struct psi_timeval_t.
+ */
+ const unsigned long getPsiTimeLo(void);
+
+ /**
+ * Retrieves the instance's current value
+ * in Psion time format, low 32 bits.
+ *
+ * @returns The instance's current time as upper 32 bits of a Psion struct psi_timeval_t.
+ */
+ const unsigned long getPsiTimeHi(void);
+
+ /**
* Prints the instance's value in human readable format.
* This function uses the current locale setting for
* formatting the time.