PageRenderTime 19ms CodeModel.GetById 16ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/mordor/date_time.cpp

http://github.com/mozy/mordor
C++ | 14 lines | 9 code | 4 blank | 1 comment | 0 complexity | 0932eb853f984f5e3d48b70cf55095e0 MD5 | raw file
 1// Copyright (c) 2009 - Mozy, Inc.
 2
 3#include "date_time.h"
 4
 5namespace Mordor {
 6
 7time_t toTimeT(const boost::posix_time::ptime &ptime)
 8{
 9    static const boost::posix_time::ptime time_t_epoch(boost::gregorian::date(1970,1,1));
10    boost::posix_time::time_duration diff = ptime - time_t_epoch;
11    return diff.total_seconds();
12}
13
14}