|
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 /* |
|
7 ** Class implementation for calendar time routines (ref: prtime.h) |
|
8 */ |
|
9 |
|
10 #include "rctime.h" |
|
11 |
|
12 RCTime::~RCTime() { } |
|
13 |
|
14 RCTime::RCTime(PRTime time): RCBase() { gmt = time; } |
|
15 RCTime::RCTime(const RCTime& his): RCBase() { gmt = his.gmt; } |
|
16 RCTime::RCTime(RCTime::Current): RCBase() { gmt = PR_Now(); } |
|
17 RCTime::RCTime(const PRExplodedTime& time): RCBase() |
|
18 { gmt = PR_ImplodeTime(&time); } |
|
19 |
|
20 void RCTime::operator=(const PRExplodedTime& time) |
|
21 { gmt = PR_ImplodeTime(&time); } |
|
22 |
|
23 RCTime RCTime::operator+(const RCTime& his) |
|
24 { RCTime sum(gmt + his.gmt); return sum; } |
|
25 |
|
26 RCTime RCTime::operator-(const RCTime& his) |
|
27 { RCTime difference(gmt - his.gmt); return difference; } |
|
28 |
|
29 RCTime RCTime::operator/(PRUint64 his) |
|
30 { RCTime quotient(gmt / gmt); return quotient; } |
|
31 |
|
32 RCTime RCTime::operator*(PRUint64 his) |
|
33 { RCTime product(gmt * his); return product; } |
|
34 |