Creating an equivalent to java's System.currentTimeMillis
Hi,
I'm trying to build an equivalent to java's System.currentTimeMillis()
using boost framework, and I've done something like that :
#include
On Thu, Jul 26, 2007 at 05:28:50PM +0200, Philippe Mondon wrote:
//long returnVal = tduration.total_milliseconds(); long returnVal = tperiod.length().total_milliseconds();
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).
Integer overflow: long is 32 bits on 32-bit machine, and 13 digits does *not* fit into 32 bits. ("long" is incidentally 64-bit in Java).
Thanks, I solved the problem using doubles. Regards. -----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Zeljko Vrba Sent: jeudi 26 juillet 2007 19:00 To: boost-users@lists.boost.org Subject: Re: [Boost-users] Creating an equivalent to java'sSystem.currentTimeMillis On Thu, Jul 26, 2007 at 05:28:50PM +0200, Philippe Mondon wrote:
//long returnVal = tduration.total_milliseconds(); long returnVal = tperiod.length().total_milliseconds();
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).
Integer overflow: long is 32 bits on 32-bit machine, and 13 digits does *not* fit into 32 bits. ("long" is incidentally 64-bit in Java). _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users 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.
participants (2)
-
Philippe Mondon
-
Zeljko Vrba