Hi,
I'm trying to build an equivalent to java's System.currentTimeMillis()
using boost framework, and I've done something like that :
#include
using namespace boost::gregorian;
using namespace boost::posix_time;
//.... Other code
long Utils::getCurrentTime()
{
ptime now(microsec_clock::universal_time());
date d(1970,boost::date_time::Jan,01);
ptime torigin(d); //midnight
//time_duration tduration = now - torigin;
time_period tperiod(torigin,now);
//long returnVal = tduration.total_milliseconds();
long returnVal = tperiod.length().total_milliseconds();
cout << "Current time : " << returnVal << endl;
return returnVal;
}
Unfortunately, it gives only a 8 digit number (in java you've got a 13
digit number when using currentTimeMillis) so I suspect that it does not
give a duration since Jan the 1st 1970 (which is java reference).
Do you have an idea of how to achieve the writing of this piece of code?
Thanks, regards.
Philippe Mondon
Equipe PAC/Architecture DIMC
Calyon
Ce message et ses pièces jointes (le "message") est destiné à l'usage
exclusif de son destinataire.
Si vous recevez ce message par erreur, merci d'en aviser immédiatement
l'expéditeur et de le détruire ensuite. Le présent message pouvant
être altéré à notre insu, CALYON Crédit Agricole CIB
ne peut pas être engagé par son contenu. Tous droits réservés.
This message and/or any attachments (the "message") is intended for
the sole use of its addressee.
If you are not the addressee, please immediately notify the sender and
then destroy the message. As this message and/or any attachments may
have been altered without our knowledge, its content is not legally
binding on CALYON Crédit Agricole CIB. All rights reserved.