tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

rctime.cpp (1173B)


      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() {
     15    gmt = time;
     16 }
     17 RCTime::RCTime(const RCTime& his): RCBase() {
     18    gmt = his.gmt;
     19 }
     20 RCTime::RCTime(RCTime::Current): RCBase() {
     21    gmt = PR_Now();
     22 }
     23 RCTime::RCTime(const PRExplodedTime& time): RCBase()
     24 {
     25    gmt = PR_ImplodeTime(&time);
     26 }
     27 
     28 void RCTime::operator=(const PRExplodedTime& time)
     29 {
     30    gmt = PR_ImplodeTime(&time);
     31 }
     32 
     33 RCTime RCTime::operator+(const RCTime& his)
     34 {
     35    RCTime sum(gmt + his.gmt);
     36    return sum;
     37 }
     38 
     39 RCTime RCTime::operator-(const RCTime& his)
     40 {
     41    RCTime difference(gmt - his.gmt);
     42    return difference;
     43 }
     44 
     45 RCTime RCTime::operator/(PRUint64 his)
     46 {
     47    RCTime quotient(gmt / gmt);
     48    return quotient;
     49 }
     50 
     51 RCTime RCTime::operator*(PRUint64 his)
     52 {
     53    RCTime product(gmt * his);
     54    return product;
     55 }