source: ntrip/trunk/BNC/bnctime.h@ 3979

Last change on this file since 3979 was 3752, checked in by mervart, 13 years ago
File size: 1.5 KB
RevLine 
[2123]1
2#ifndef BNCTIME_H
3#define BNCTIME_H
4
5#include <string>
6
7class bncTime {
8 public:
9 bncTime() {this->reset();}
10 bncTime(int gpsw, double gpssec);
11
12 bncTime& set(int gpsw, double gpssec);
[2251]13 bncTime& set(int year, int month, int day, int hour, int min, double sec);
14 bncTime& set(int year, int month, int day, double daysec);
[3507]15 bncTime& setmjd(double daysec, int mjd);
[2123]16
[3752]17 void reset() {_mjd = 0; _sec = 0;}
[2123]18 unsigned int mjd() const;
19 double daysec() const;
20 unsigned int gpsw() const;
21 double gpssec() const;
[2566]22 void civil_date (unsigned int& year, unsigned int& month,
23 unsigned int& day) const;
[2177]24 void civil_time (unsigned int& hour, unsigned int& min,
25 double& sec) const;
[2809]26 bool valid() const {return _mjd != 0 || _sec != 0.0;}
[2917]27 bool operator==(const bncTime &time1) const;
[2809]28 bool operator!=(const bncTime &time1) const;
[2923]29 bool operator<(const bncTime &time1) const;
30 bool operator>(const bncTime &time1) const;
31 bool operator<=(const bncTime &time1) const;
32 bool operator>=(const bncTime &time1) const;
[2809]33 double operator-(const bncTime &time1) const;
34 bncTime operator-(double sec) const;
35 bncTime operator+(double sec) const;
[2123]36
37 std::string timestr(unsigned numdec = 3, char sep = ':') const;
[2566]38 std::string datestr(char sep = '-') const;
[2123]39
40 private:
41 unsigned int _mjd;
42 double _sec;
43};
44
45#endif
46
Note: See TracBrowser for help on using the repository browser.