|
plptools
|
Psion time related utility class. More...
#include <psitime.h>

Public Types | |
| enum | zone { PSI_TZ_NONE = 0 , PSI_TZ_EUROPEAN = 1 , PSI_TZ_NORTHERN = 2 , PSI_TZ_SOUTHERN = 4 , PSI_TZ_HOME = 0x40000000 } |
Public Member Functions | |
| PsiTime (struct timeval *_utv, struct timezone *_utz=nullptr) | |
| Contructs a new instance. More... | |
| PsiTime (time_t time) | |
| Contructs a new instance. More... | |
| PsiTime (psi_timeval *_ptv, psi_timezone *_ptz=nullptr) | |
| Contructs a new instance. More... | |
| PsiTime (const uint32_t _ptvHi, const uint32_t _ptvLo) | |
| Contructs a new instance. More... | |
| PsiTime (void) | |
| Constructs a new instance, initializing to now. More... | |
| PsiTime (const PsiTime &t) | |
| A copy-constructor. More... | |
| ~PsiTime () | |
| Destroys the instance. More... | |
| void | setPsiTime (psi_timeval *_ptv) |
| Modifies the value of this instance. More... | |
| void | setSiboTime (uint32_t stime) |
| Modifies the value of this instance. More... | |
| void | setPsiTime (const uint32_t _ptvHi, const uint32_t _ptvLo) |
| Modifies the value of this instance. More... | |
| void | setPsiZone (psi_timezone *_ptz) |
| Sets the Psion time zone of this instance. More... | |
| void | setUnixTime (struct timeval *_utv) |
| Sets the value of this instance. More... | |
| void | setUnixTime (time_t time) |
| Sets the value of this instance. More... | |
| void | setUnixNow (void) |
| Sets the value of this instance to the current time of the Unix machine. More... | |
| struct timeval & | getTimeval (void) |
| Retrieves the instance's current value in Unix time format. More... | |
| time_t | getTime (void) |
| Retrieves the instance's current value in Unix time format. More... | |
| uint32_t | getSiboTime () |
| Retrieves the instance's current value in SIBO time format. More... | |
| psi_timeval & | getPsiTimeval (void) |
| Retrieves the instance's current value in Psion time format. More... | |
| uint32_t | getPsiTimeLo (void) |
| Retrieves the instance's current value in Psion time format, high 32 bits. More... | |
| uint32_t | getPsiTimeHi (void) |
| Retrieves the instance's current value in Psion time format, low 32 bits. More... | |
| PsiTime & | operator= (const PsiTime &t) |
| Assignment operator. More... | |
| bool | operator== (const PsiTime &t) |
| Comparison operators. More... | |
| bool | operator< (const PsiTime &t) |
| bool | operator> (const PsiTime &t) |
Private Member Functions | |
| void | psi2unix (void) |
| void | unix2psi (void) |
| void | tryPsiZone () |
Private Attributes | |
| psi_timeval | ptv |
| psi_timezone | ptz |
| struct timeval | utv |
| struct timezone | utz |
| bool | ptzValid |
Friends | |
| std::ostream & | operator<< (std::ostream &s, const PsiTime &t) |
| Prints the instance's value in human readable format. More... | |
Psion time related utility class.
PsiTime provides easy access to the time format, used when communicating with a Psion. Internally, the time is always normalized to GMT. The time value can be set and retrieved in both Unix and Psion formats. This allows easy conversion between both formats. NOTE: For proper conversion, the current timezone of the Psion has to be set. For EPOC devices, the timezone can be evaluated using rpcs::getMachineInfo . For SIBO devices, unfortunately there is no known method of retrieving this information. Therefore, if the timezone is not set, a fallback using the environment variable PSI_TZ is provided. Users should set this variable to the offset of their time zone in seconds. If PSI_TZ 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.
| enum PsiTime::zone |
| PsiTime::PsiTime | ( | struct timeval * | _utv, |
| struct timezone * | _utz = nullptr |
||
| ) |
Contructs a new instance.
| _utv | A Unix time value for initialization. |
| _utz | A Unix timezone for initialization. |
Definition at line 68 of file psitime.cc.
| PsiTime::PsiTime | ( | time_t | time | ) |
Contructs a new instance.
| time | A Unix time value for initialization. |
Definition at line 37 of file psitime.cc.
| PsiTime::PsiTime | ( | psi_timeval * | _ptv, |
| psi_timezone * | _ptz = nullptr |
||
| ) |
Contructs a new instance.
Definition at line 43 of file psitime.cc.
| PsiTime::PsiTime | ( | const uint32_t | _ptvHi, |
| const uint32_t | _ptvLo | ||
| ) |
Contructs a new instance.
| _ptvHi | The high 32 bits of a Psion time value for initialization. |
| _ptvLo | The low 32 bits of a Psion time value for initialization. |
Definition at line 58 of file psitime.cc.
| PsiTime::PsiTime | ( | void | ) |
Constructs a new instance, initializing to now.
Definition at line 31 of file psitime.cc.
| PsiTime::PsiTime | ( | const PsiTime & | t | ) |
A copy-constructor.
Definition at line 77 of file psitime.cc.
| PsiTime::~PsiTime | ( | ) |
Destroys the instance.
Definition at line 86 of file psitime.cc.
| uint32_t PsiTime::getPsiTimeHi | ( | void | ) |
Retrieves the instance's current value in Psion time format, low 32 bits.
Definition at line 144 of file psitime.cc.
| uint32_t PsiTime::getPsiTimeLo | ( | void | ) |
Retrieves the instance's current value in Psion time format, high 32 bits.
Definition at line 140 of file psitime.cc.
| psi_timeval & PsiTime::getPsiTimeval | ( | void | ) |
Retrieves the instance's current value in Psion time format.
Definition at line 136 of file psitime.cc.
| uint32_t PsiTime::getSiboTime | ( | void | ) |
Retrieves the instance's current value in SIBO time format.
Definition at line 246 of file psitime.cc.
| time_t PsiTime::getTime | ( | void | ) |
Retrieves the instance's current value in Unix time format.
Definition at line 132 of file psitime.cc.
| struct timeval & PsiTime::getTimeval | ( | void | ) |
Retrieves the instance's current value in Unix time format.
Definition at line 128 of file psitime.cc.
| bool PsiTime::operator< | ( | const PsiTime & | t | ) |
Definition at line 164 of file psitime.cc.
Assignment operator.
Definition at line 148 of file psitime.cc.
| bool PsiTime::operator== | ( | const PsiTime & | t | ) |
Comparison operators.
Definition at line 158 of file psitime.cc.
| bool PsiTime::operator> | ( | const PsiTime & | t | ) |
Definition at line 172 of file psitime.cc.
|
private |
Definition at line 253 of file psitime.cc.
| void PsiTime::setPsiTime | ( | const uint32_t | _ptvHi, |
| const uint32_t | _ptvLo | ||
| ) |
Modifies the value of this instance.
Definition at line 114 of file psitime.cc.
| void PsiTime::setPsiTime | ( | psi_timeval * | _ptv | ) |
Modifies the value of this instance.
| _ptv | The new Psion time representation. |
Definition at line 108 of file psitime.cc.
| void PsiTime::setPsiZone | ( | psi_timezone * | _ptz | ) |
Sets the Psion time zone of this instance.
| _ptz | The new Psion time zone. |
Definition at line 120 of file psitime.cc.
| void PsiTime::setSiboTime | ( | uint32_t | stime | ) |
Modifies the value of this instance.
| stime | The new SIBO time representation. |
Definition at line 237 of file psitime.cc.
| void PsiTime::setUnixNow | ( | void | ) |
Sets the value of this instance to the current time of the Unix machine.
Definition at line 102 of file psitime.cc.
| void PsiTime::setUnixTime | ( | struct timeval * | _utv | ) |
Sets the value of this instance.
| _utv | The new Unix time representation. |
Definition at line 90 of file psitime.cc.
| void PsiTime::setUnixTime | ( | time_t | time | ) |
Sets the value of this instance.
| time | The new Unix time representation. |
Definition at line 96 of file psitime.cc.
|
private |
Definition at line 276 of file psitime.cc.
|
private |
Definition at line 265 of file psitime.cc.
|
friend |
Prints the instance's value in human readable format.
This function uses the current locale setting for formatting the time.
| s | The stream to be written. |
| t | The instance whose value should be displayed. |
Definition at line 180 of file psitime.cc.
|
private |
|
private |