Ask a Question related to UNIX Programming, Design and Development.
-
John Smith #1
function to get time in seconds and milliseconds
Hi,
Is there a function in Solaris 8 that would return time in seconds (since
1970) and also contain millisecond part of the time. I know there are
functions to obtain time in seconds but I don't think they contain
millisecond part.
Would it be possible for you to also supply sample code.
Thanks!
John Smith Guest
-
Shock Player has slow buffering time of 50 seconds
i looked in add-ins for internet explorer 7 and i do not have adobe flash player but i do have shockwave flash object publisher: adobe systems... -
Time Format in datagrid (Hours, Minutes, Seconds)
I have a column in my database that stores total seconds. I want to bind this colum to my datagrid. Is there a way to have the time show as hours,... -
#25150 [Fbk->NoF]: Maximum execution time of 30 seconds exceeded
ID: 25150 Updated by: sniper@php.net Reported By: alain at antinea dot org -Status: Feedback +Status: ... -
#25150 [NEW]: Maximum execution time of 30 seconds exceeded
From: alain at antinea dot org Operating system: Linux PHP version: 4.3.2 PHP Bug Type: *General Issues Bug description: ... -
Time compare using milliseconds
Hello all, I have two timestamps that look like this: 08:42:38:624 08:42:39:437 I need to find out the difference. I have never worked with... -
John Smith #2
function to get time in seconds and milliseconds
Hi,
Is there a function in Solaris 8 that would return time in seconds (since
1970) and also contain millisecond part of the time. I know there are
functions to obtain time in seconds but I don't think they contain
millisecond part.
Would it be possible for you to also supply sample code.
Thanks!
John Smith Guest
-
Rich Teer #3
Re: function to get time in seconds and milliseconds
On Sat, 5 Jul 2003, John Smith wrote:
You can use gettimeofday(), but I don't think there's a> Is there a function in Solaris 8 that would return time in seconds (since
> 1970) and also contain millisecond part of the time. I know there are
> functions to obtain time in seconds but I don't think they contain
> millisecond part.
guarantee of sub-second resolution. Why do you need this
resolution? Odds are there are better ways than time since
the epoch...
--
Rich Teer, SCNA, SCSA
President,
Rite Online Inc.
Voice: +1 (250) 979-1638
URL: [url]http://www.rite-online.net[/url]
Rich Teer Guest
-
Rich Teer #4
Re: function to get time in seconds and milliseconds
On Sat, 5 Jul 2003, John Smith wrote:
You can use gettimeofday(), but I don't think there's a> Is there a function in Solaris 8 that would return time in seconds (since
> 1970) and also contain millisecond part of the time. I know there are
> functions to obtain time in seconds but I don't think they contain
> millisecond part.
guarantee of sub-second resolution. Why do you need this
resolution? Odds are there are better ways than time since
the epoch...
--
Rich Teer, SCNA, SCSA
President,
Rite Online Inc.
Voice: +1 (250) 979-1638
URL: [url]http://www.rite-online.net[/url]
Rich Teer Guest
-
John Smith #5
Re: function to get time in seconds and milliseconds
"Rich Teer" <rich.teer@rite-group.com> wrote in message
news:Pine.GSO.4.44.0307051645400.448-100000@zaphod.rite-group.com...(since> On Sat, 5 Jul 2003, John Smith wrote:
>> > Is there a function in Solaris 8 that would return time in secondsHi,>> > 1970) and also contain millisecond part of the time. I know there are
> > functions to obtain time in seconds but I don't think they contain
> > millisecond part.
> You can use gettimeofday(), but I don't think there's a
> guarantee of sub-second resolution. Why do you need this
> resolution? Odds are there are better ways than time since
> the epoch...
The reason why I needed this type of resolution is because I am writing a
simulator and the proprietary protocol that I am working with requires me to
put time in seconds part + millisecond part in each message header. Does
Solaris even keep time in millisecond resolution?
John Smith Guest
-
John Smith #6
Re: function to get time in seconds and milliseconds
"Rich Teer" <rich.teer@rite-group.com> wrote in message
news:Pine.GSO.4.44.0307051645400.448-100000@zaphod.rite-group.com...(since> On Sat, 5 Jul 2003, John Smith wrote:
>> > Is there a function in Solaris 8 that would return time in secondsHi,>> > 1970) and also contain millisecond part of the time. I know there are
> > functions to obtain time in seconds but I don't think they contain
> > millisecond part.
> You can use gettimeofday(), but I don't think there's a
> guarantee of sub-second resolution. Why do you need this
> resolution? Odds are there are better ways than time since
> the epoch...
The reason why I needed this type of resolution is because I am writing a
simulator and the proprietary protocol that I am working with requires me to
put time in seconds part + millisecond part in each message header. Does
Solaris even keep time in millisecond resolution?
John Smith Guest
-
David Schwartz #7
Re: function to get time in seconds and milliseconds
"John Smith" <John_Smith273@cox.net> wrote in message
news:wbKNa.120012$MJ5.8291@fed1read03...
to> The reason why I needed this type of resolution is because I am writing a
> simulator and the proprietary protocol that I am working with requires meThe 'gettimeofday' function will give you the platform's best guess of> put time in seconds part + millisecond part in each message header. Does
> Solaris even keep time in millisecond resolution?
the current time in seconds and microseconds. What resolution the system
actually has will vary based on the hardware.
I tried this program on a few sparch Solaris machines:
#include <time.h>
#include <sys/time.h>
int main(void)
{
struct timeval t1, t2;
gettimeofday(&t1, NULL);
do gettimeofday(&t2, NULL); while (t1.tv_usec==t2.tv_usec);
printf("Resolution guess, %d usec\n", t2.tv_usec-t1.tv_usec);
}
And I usually get '1 usec', suggesting that the machine has at least
microsecond resolution.
Of course, the accuracy with respect to UTC will depend upon how well
the clock is synchronized to UTC. But it should be suitable for figuring out
the time between events that all take place on the same machine.
DS
David Schwartz Guest
-
David Schwartz #8
Re: function to get time in seconds and milliseconds
"John Smith" <John_Smith273@cox.net> wrote in message
news:wbKNa.120012$MJ5.8291@fed1read03...
to> The reason why I needed this type of resolution is because I am writing a
> simulator and the proprietary protocol that I am working with requires meThe 'gettimeofday' function will give you the platform's best guess of> put time in seconds part + millisecond part in each message header. Does
> Solaris even keep time in millisecond resolution?
the current time in seconds and microseconds. What resolution the system
actually has will vary based on the hardware.
I tried this program on a few sparch Solaris machines:
#include <time.h>
#include <sys/time.h>
int main(void)
{
struct timeval t1, t2;
gettimeofday(&t1, NULL);
do gettimeofday(&t2, NULL); while (t1.tv_usec==t2.tv_usec);
printf("Resolution guess, %d usec\n", t2.tv_usec-t1.tv_usec);
}
And I usually get '1 usec', suggesting that the machine has at least
microsecond resolution.
Of course, the accuracy with respect to UTC will depend upon how well
the clock is synchronized to UTC. But it should be suitable for figuring out
the time between events that all take place on the same machine.
DS
David Schwartz Guest
-
Michael B Allen #9
Re: function to get time in seconds and milliseconds
On Sat, 05 Jul 2003 19:43:03 -0400, John Smith wrote:
Try gettimeofday.> Hi,
>
> Is there a function in Solaris 8 that would return time in seconds
> (since 1970) and also contain millisecond part of the time.
Mike
Michael B Allen Guest
-
Michael B Allen #10
Re: function to get time in seconds and milliseconds
On Sat, 05 Jul 2003 19:43:03 -0400, John Smith wrote:
Try gettimeofday.> Hi,
>
> Is there a function in Solaris 8 that would return time in seconds
> (since 1970) and also contain millisecond part of the time.
Mike
Michael B Allen Guest
-
Joerg Schilling #11
Re: function to get time in seconds and milliseconds
In article <wbKNa.120012$MJ5.8291@fed1read03>,
John Smith <John_Smith273@cox.net> wrote:No, it keeps time in sub-microsecond resolution.>>>
>> You can use gettimeofday(), but I don't think there's a
>> guarantee of sub-second resolution. Why do you need this
>> resolution? Odds are there are better ways than time since
>> the epoch...
>The reason why I needed this type of resolution is because I am writing a
>simulator and the proprietary protocol that I am working with requires me to
>put time in seconds part + millisecond part in each message header. Does
>Solaris even keep time in millisecond resolution?
--
EMail:joerg@schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin
[email]js@cs.tu-berlin.de[/email] (uni) If you don't have iso-8859-1
[email]schilling@fokus.fraunhofer.de[/email] (work) chars I am J"org Schilling
URL: [url]http://www.fokus.fraunhofer.de/usr/schilling[/url] [url]ftp://ftp.berlios.de/pub/schily[/url]
Joerg Schilling Guest
-
Joerg Schilling #12
Re: function to get time in seconds and milliseconds
In article <wbKNa.120012$MJ5.8291@fed1read03>,
John Smith <John_Smith273@cox.net> wrote:No, it keeps time in sub-microsecond resolution.>>>
>> You can use gettimeofday(), but I don't think there's a
>> guarantee of sub-second resolution. Why do you need this
>> resolution? Odds are there are better ways than time since
>> the epoch...
>The reason why I needed this type of resolution is because I am writing a
>simulator and the proprietary protocol that I am working with requires me to
>put time in seconds part + millisecond part in each message header. Does
>Solaris even keep time in millisecond resolution?
--
EMail:joerg@schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin
[email]js@cs.tu-berlin.de[/email] (uni) If you don't have iso-8859-1
[email]schilling@fokus.fraunhofer.de[/email] (work) chars I am J"org Schilling
URL: [url]http://www.fokus.fraunhofer.de/usr/schilling[/url] [url]ftp://ftp.berlios.de/pub/schily[/url]
Joerg Schilling Guest
-
Alex Vinokur #13
Re: function to get time in seconds and milliseconds
"John Smith" <John_Smith273@cox.net> wrote in message news:2oJNa.119999$MJ5.1555@fed1read03...gethrtime()> Hi,
>
> Is there a function in Solaris 8 that would return time in seconds (since
> 1970) and also contain millisecond part of the time. I know there are
> functions to obtain time in seconds but I don't think they contain
> millisecond part.
>
> Would it be possible for you to also supply sample code.
>
> Thanks!
>
>
[url]http://groups.google.com/groups?selm=36822F3A.DBFF0811%40tibam.elex.co.il[/url]
[url]http://groups.google.com/groups?selm=368734F0.70B29CE2%40tibam.elex.co.il[/url]
getrusage()
See C/C++ Program Perfometer :
[url]http://sourceforge.net/projects/cpp-perfometer[/url]
[url]http://alexvn.freeservers.com/s1/perfometer.html[/url]
==========================================
Alex Vinokur
mailto:alexvn@connect.to
[url]http://www.simtel.net/pub/oth/19088.html[/url]
[url]http://sourceforge.net/users/alexvn[/url]
==========================================
Alex Vinokur Guest
-
Alex Vinokur #14
Re: function to get time in seconds and milliseconds
"John Smith" <John_Smith273@cox.net> wrote in message news:2oJNa.119999$MJ5.1555@fed1read03...gethrtime()> Hi,
>
> Is there a function in Solaris 8 that would return time in seconds (since
> 1970) and also contain millisecond part of the time. I know there are
> functions to obtain time in seconds but I don't think they contain
> millisecond part.
>
> Would it be possible for you to also supply sample code.
>
> Thanks!
>
>
[url]http://groups.google.com/groups?selm=36822F3A.DBFF0811%40tibam.elex.co.il[/url]
[url]http://groups.google.com/groups?selm=368734F0.70B29CE2%40tibam.elex.co.il[/url]
getrusage()
See C/C++ Program Perfometer :
[url]http://sourceforge.net/projects/cpp-perfometer[/url]
[url]http://alexvn.freeservers.com/s1/perfometer.html[/url]
==========================================
Alex Vinokur
mailto:alexvn@connect.to
[url]http://www.simtel.net/pub/oth/19088.html[/url]
[url]http://sourceforge.net/users/alexvn[/url]
==========================================
Alex Vinokur Guest
-
Edward Lloyd Hillman #15
Re: function to get time in seconds and milliseconds
In article <pan.2003.07.06.01.06.08.423187.4856@ioplex.com> ,
Michael B Allen <mba2000@ioplex.com> writes:> On Sat, 05 Jul 2003 19:43:03 -0400, John Smith wrote:
>>>> Hi,
>>
>> Is there a function in Solaris 8 that would return time in seconds
>> (since 1970) and also contain millisecond part of the time.
> Try gettimeofday.
>
> Mike
I've used "clock_gettime"; that returns time in seconds and nanoseconds.
--
Edward Lloyd Hillman
Signature?!? I don't need no stinking signature!!
<mailto:ehillman@iamdigex.net>
Edward Lloyd Hillman Guest
-
Edward Lloyd Hillman #16
Re: function to get time in seconds and milliseconds
In article <pan.2003.07.06.01.06.08.423187.4856@ioplex.com> ,
Michael B Allen <mba2000@ioplex.com> writes:> On Sat, 05 Jul 2003 19:43:03 -0400, John Smith wrote:
>>>> Hi,
>>
>> Is there a function in Solaris 8 that would return time in seconds
>> (since 1970) and also contain millisecond part of the time.
> Try gettimeofday.
>
> Mike
I've used "clock_gettime"; that returns time in seconds and nanoseconds.
--
Edward Lloyd Hillman
Signature?!? I don't need no stinking signature!!
<mailto:ehillman@iamdigex.net>
Edward Lloyd Hillman Guest
-
John Smith #17
Re: function to get time in seconds and milliseconds
"John Smith" <John_Smith273@cox.net> wrote in message
news:2oJNa.119999$MJ5.1555@fed1read03...Thank you all for your help! I really appreciated the feedback you have> Hi,
>
> Is there a function in Solaris 8 that would return time in seconds (since
> 1970) and also contain millisecond part of the time. I know there are
> functions to obtain time in seconds but I don't think they contain
> millisecond part.
>
> Would it be possible for you to also supply sample code.
>
> Thanks!
provided.
John Smith Guest
-
John Smith #18
Re: function to get time in seconds and milliseconds
"John Smith" <John_Smith273@cox.net> wrote in message
news:2oJNa.119999$MJ5.1555@fed1read03...Thank you all for your help! I really appreciated the feedback you have> Hi,
>
> Is there a function in Solaris 8 that would return time in seconds (since
> 1970) and also contain millisecond part of the time. I know there are
> functions to obtain time in seconds but I don't think they contain
> millisecond part.
>
> Would it be possible for you to also supply sample code.
>
> Thanks!
provided.
John Smith Guest



Reply With Quote

