PageRenderTime 7ms CodeModel.GetById 1ms RepoModel.GetById 0ms 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
Possible License(s): BSD-3-Clause
  1. // Copyright (c) 2009 - Mozy, Inc.
  2. #include "date_time.h"
  3. namespace Mordor {
  4. time_t toTimeT(const boost::posix_time::ptime &ptime)
  5. {
  6. static const boost::posix_time::ptime time_t_epoch(boost::gregorian::date(1970,1,1));
  7. boost::posix_time::time_duration diff = ptime - time_t_epoch;
  8. return diff.total_seconds();
  9. }
  10. }