Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: get current time with milliseconds?


From   Sergiy Radyakin <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: get current time with milliseconds?
Date   Mon, 22 Jul 2013 23:35:58 -0400

Hi Iip,

First, you may want to elaborate on your particular problem you are
solving. Be careful because as we know: " The OS Components may
contain support for programs written in Java. Java technology is not
fault tolerant and is not designed, manufactured, or intended for use
or resale as on-line control equipment in hazardous environments
requiring fail-safe performance, such as in the operation of nuclear
facilities, aircraft navigation or communication systems, air traffic
control, direct life support machines, or weapons systems, in which
the failure of Java technology could lead directly to death, personal
injury, or severe physical or environmental damage. " (
http://technet.microsoft.com/en-us/library/cc976720.aspx )

Second, read the following article:
http://msdn.microsoft.com/en-us/magazine/cc163996.aspx

Now given that Stata is cross-platform, and that "timestamps ... from
Windows NT are limited to a maximum resolution of 10 or 15
milliseconds, depending on the underlying hardware" you will have a
decent problem to have such a precise measurement. And by that I mean
"current time to milliseconds", I don't mean just any time close to
current, with some milliseconds attached to it. Note that neither
Windows XP, nor Windows Server 2003, nor earlier versions of Windows
can't use HPET (if you count on it).

In any case here is what you may want to explore, and more suggestions
will probably come from others:
1) to time performance of code repeat the code multiple times, then
you need to measure seconds;
2) to get the world time consult an online service, many are linked to
atomic clocks worldwide; transmission delay is usually a fraction of a
second (about 0.2 here) and it takes several seconds to synchronize;
3) to get really precise time measurement you may want to attach a GPS
dongle and read time from there. that might give you up to a 40ns
resolution, not sure how fast your program will be able to digest it;
4) to get random numbers use truernd or other similar approaches.

Finally, Stata advertizes: "High-frequency data with millisecond
resolution" here: http://www.stata.com/features/time-series/
But I always assumed that the above refers to the ability to
manipulate data stored with such precise timestamps, not to generate
and timestamp it with such high frequency.


Best, Sergiy Radyakin

On Mon, Jul 22, 2013 at 9:10 PM, iip <[email protected]> wrote:
> On Thu, Jul 18, 2013 at 12:29 PM, iip <[email protected]> wrote:
>> Hi All,
>>
>> I'm trying to get current time with milliseconds, using
>> c(current_time) only get seconds, how to get time including a
>> milliseconds?
>>
>> Thanks,
>>
>> -iip-
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index