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

Last change on this file since 3302 was 2923, checked in by mervart, 14 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);
[2123]15
16 unsigned int mjd() const;
17 double daysec() const;
18 unsigned int gpsw() const;
19 double gpssec() const;
[2566]20 void civil_date (unsigned int& year, unsigned int& month,
21 unsigned int& day) const;
[2177]22 void civil_time (unsigned int& hour, unsigned int& min,
23 double& sec) const;
[2809]24 bool valid() const {return _mjd != 0 || _sec != 0.0;}
[2917]25 bool operator==(const bncTime &time1) const;
[2809]26 bool operator!=(const bncTime &time1) const;
[2923]27 bool operator<(const bncTime &time1) const;
28 bool operator>(const bncTime &time1) const;
29 bool operator<=(const bncTime &time1) const;
30 bool operator>=(const bncTime &time1) const;
[2809]31 double operator-(const bncTime &time1) const;
32 bncTime operator-(double sec) const;
33 bncTime operator+(double sec) const;
[2123]34
35 std::string timestr(unsigned numdec = 3, char sep = ':') const;
[2566]36 std::string datestr(char sep = '-') const;
[2123]37
38 private:
39 bncTime& setmjd(double daysec, int mjd);
40 void reset() {_mjd = 0; _sec = 0;}
41
42 unsigned int _mjd;
43 double _sec;
44};
45
46#endif
47
Note: See TracBrowser for help on using the repository browser.