~haggai-eran/nux/rtl-rebased

« back to all changes in this revision

Viewing changes to NuxCore/TimeFunctions.cpp

  • Committer: Jay Taoko
  • Date: 2011-10-21 23:49:15 UTC
  • mfrom: (508.1.2 nux-20)
  • Revision ID: jay.taoko@canonical.com-20111021234915-hnzakb5ndebica8i
* Removed custom Nux types: t_u32, t_s32, t_bool, ...

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
  }
43
43
 
44
44
 
45
 
  t_s64 TimeStamp::GetJulianDayNumber (void) const
 
45
  long long TimeStamp::GetJulianDayNumber (void) const
46
46
  {
47
 
    t_s64 JDN =  m_Day - 32075L +
 
47
    long long JDN =  m_Day - 32075L +
48
48
                 1461L * (m_Year  + 4800L + (m_Month  - 14L) / 12L) / 4L +
49
49
                 367L * (m_Month - 2L - ( (m_Month - 14L) / 12L) * 12L) / 12L -
50
50
                 3L * ( (m_Year + 4900L - (m_Month  - 14L) / 12L) / 100L) / 4L;
51
51
    return JDN;
52
52
  }
53
53
 
54
 
  t_f64 TimeStamp::GetJulianDate() const
 
54
  double TimeStamp::GetJulianDate() const
55
55
  {
56
 
    t_f64 JD = GetJulianDayNumber() + (m_Hour - 12) / 1440.0f + m_Minute / 1440.0f + m_Second / 86400.0f;
 
56
    double JD = GetJulianDayNumber() + (m_Hour - 12) / 1440.0f + m_Minute / 1440.0f + m_Second / 86400.0f;
57
57
    return JD;
58
58
  }
59
59
 
83
83
 
84
84
  bool TimeStamp::operator < (TimeStamp &Other) const
85
85
  {
86
 
    t_f64 JD = GetJulianDate();
 
86
    double JD = GetJulianDate();
87
87
 
88
88
    if (JD < Other.GetJulianDate() )
89
89
      return true;
93
93
 
94
94
  bool TimeStamp::operator >  (TimeStamp &Other) const
95
95
  {
96
 
    t_f64 JD = GetJulianDate();
 
96
    double JD = GetJulianDate();
97
97
 
98
98
    if (JD > Other.GetJulianDate() )
99
99
      return true;
103
103
 
104
104
  bool TimeStamp::operator >= (TimeStamp &Other) const
105
105
  {
106
 
    t_f64 JD = GetJulianDate();
 
106
    double JD = GetJulianDate();
107
107
 
108
108
    if (JD >= Other.GetJulianDate() )
109
109
      return true;
113
113
 
114
114
  bool TimeStamp::operator <= (TimeStamp &Other) const
115
115
  {
116
 
    t_f64 JD = GetJulianDate();
 
116
    double JD = GetJulianDate();
117
117
 
118
118
    if (JD <= Other.GetJulianDate() )
119
119
      return true;
228
228
#endif
229
229
  }
230
230
 
231
 
  t_long GetTimeZone()
 
231
  long GetTimeZone()
232
232
  {
233
233
#if (defined _WIN32)
234
 
    t_long seconds = 0;
 
234
    long seconds = 0;
235
235
    _get_timezone (&seconds);
236
 
    t_long hour = seconds / 3600;
 
236
    long hour = seconds / 3600;
237
237
    return hour;
238
238
#else
239
239
    return 0;