Chris has given you the correct answer (Environment.TickCount) for timing
milliseconds.
"Chris Tacke, eMVP" wrote:
> Environment.TickCount is what you want. The Perf counters can give even
> higher resolution.
>
> -Chris
>
>
> "Jim H" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > I'm trying to measure between 2 events. I'm reading from a connection and
> I
> > need to record the time between the packets of data I get back.
> >
> > DateTime.Now.Ticks is supposed to be the tick count. According to the
> > documentation:
> > The value of this property is the number of 100-nanosecond intervals that
> > have elapsed since 12:00 A.M., January 1, 0001.
> >
> > But the values coming back from the PPC seem to only be accurate to the
> ten
> > millions. All the numbers that came back had 7 0's after them. No number
> > was any more accurate than that.
> >
> > Thanks,
> > jim
> >
> >
> > "Paul G. Tobey [eMVP]" <ptobey no spam AT no instrument no spam DOT com>
> > wrote in message news:%(E-Mail Removed)...
> > > "Gaps" I'm not sure about but, as you know, the hardware inside a PPC is
> > > not the same as the hardware inside a PC, including timers. If you
> > > P/Invoke to GetTickCount(), that will return a number of timer ticks
> since
> > > startup. Since it's a 32-bit value, it will roll over periodically and
> > > you'll have to handle that, but it should give you one tick per ms
> > > (0.001). It's possible that QueryPerformanceCounter() would also work
> on
> > > PPC (I don't have any PPC devices to try it). That might give you a
> > > higher-resolution counter.
> > >
> > > What is it that you are trying to do with this time? Calculate a really
> > > accurate time-of-day? Or measure a delta between two events?
> > >
> > > Paul T.
> > >
> > > "Jim H" <(E-Mail Removed)> wrote in message
> > > news:%(E-Mail Removed)...
> > >>I need to keep the time with data that is coming into my app. On the
> > >>desktop I use DateTime.Now.Ticks to get a time stamp down to the
> > >>thousandths of a second. On the desktop is gave me numbers like this:
> > >> 632312367562450276
> > >> 632312367562606512
> > >>
> > >> On the PPC I get numbers like this:
> > >> 632314491430000000
> > >> 632314491500000000
> > >>
> > >> The precision is not there. The numbers I get from the PPC have gaps
> > >> anywhere from 2 to 5 seconds. The gaps on the desktop are approx .015
> > >> seconds. Is there a way to get a more accurate time stamp from PPC?
> > >>
> > >> Thanks,
> > >> jim
> > >>
> > >
> > >
> >
> >
>
>
>
|