Sponsored Content
Top Forums Programming Help! Display Time with Millisecond Post 13702 by Neo on Tuesday 22nd of January 2002 03:17:30 PM
Old 01-22-2002
Try these links and quotes and see if they help your research:

http://www.mcsr.olemiss.edu/cgi-bin/man-cgi?timers+5

Quote:
time() returns milliseconds since Jan 1, 1970. This number will not overflow any integer wheels until July 8, 2038 (at 03:14:07 UTC if you want to time it). By then, I fully expect everyone to be on at least 64-bit platforms, which means it will cease to matter until well after we're dead and gone. No one EVER writes code that "only looks at the first 9 digits" because hardly anyone ever even uses the "real" value of time(). It is usually converted into a human-readable form with the localtime() function."
From thread:

http://www.sunmanagers.org/pipermail...ly/001059.html

Others can be found at www.google.com using the keywords:

UNIX time milliseconds
 

9 More Discussions You Might Find Interesting

1. Solaris

display date n Time

Hi Friends, Can any one guide me regarding 'Display the date and time' command other than the command 'date' thanks n regards SsRrIi (1 Reply)
Discussion started by: SsRrIi
1 Replies

2. Shell Programming and Scripting

How to find date Difference in AWK/GAWK with millisecond precision

Hi, I have a log file that has the date in this format "2006-05-30_13:14:04,256". I need to find the time difference between two log entries in milliseconds. How to achieve this in AWK/GAWK script? :confused: (2 Replies)
Discussion started by: omprasad
2 Replies

3. Shell Programming and Scripting

how to display time in minutes n seconds...

Hi all, may i know how to display time in minutes and seconds(may be milliseconds and even smaller that ) in shell scripts.... (1 Reply)
Discussion started by: santy
1 Replies

4. Shell Programming and Scripting

display TIME - help

i an trying to display current time in the expect script. it works fine in normal shell script but does not in expect. can anybody help me with the synatx to display it. (2 Replies)
Discussion started by: iamcool
2 Replies

5. Shell Programming and Scripting

Script to display time difference..

Hi i've written a script which reads last two line of the log file from N number of servers and send the mail by redirecting to a particular log file. And the two lines is displayed below. Oracle Q03 Begin Hot BACKUP Time: 07/23/08 18:35:46 Oracle Q03 End Hot BACKUP Time: 07/24/08 14:18:15... (1 Reply)
Discussion started by: suri.tyson
1 Replies

6. Shell Programming and Scripting

script to display time

hey folks, i am stuc in this problem. You all might help me out. I want to write a BASH script to display time every 15 seconds using %r field descriptor. And want to clear the window each time before displaying time using clear command. Please help me out (3 Replies)
Discussion started by: manojrsb
3 Replies

7. Shell Programming and Scripting

Get timestamp with millisecond precision

Hi All, could any body let me know. how to get timestamp with millisecond precision in unix bash shell. example -->2005-12-06- 4-22-35-195 please help me. Thanks, Krupa:wall: (3 Replies)
Discussion started by: krupasindhu18
3 Replies

8. Post Here to Contact Site Administrators and Moderators

Display time in 12 hr format

Write a script named time that displays the time in standard 12-hour format, rather than 24-hour format. Allow the user to give a -m option to get 24-hour format. For example: > date Sun Feb 10 10:56:50 CST 2008 > time 10:56 AM > date Sun Feb 10 21:57:07 CST 2008 > time 9:57 PM >... (0 Replies)
Discussion started by: satish24
0 Replies

9. UNIX for Advanced & Expert Users

Subtract millisecond Timestamps with awk

Hello, am not able to subtract timestamps in milliseconds. I extract the timestamp as a string, and then try to subtract the two, but since it is a string, system just outputs 0 awk -F"," 'substr($1,0,13) - substr($2,0,013)' File where $1 and $2 are the timestamps in the format... (4 Replies)
Discussion started by: sidnow
4 Replies
Stopwatch(3pm)						User Contributed Perl Documentation					    Stopwatch(3pm)

NAME
Time::Stopwatch - Use tied scalars as timers SYNOPSIS
use Time::Stopwatch; tie my $timer, 'Time::Stopwatch'; do_something(); print "Did something in $timer seconds. "; my @times = map { $timer = 0; do_something_else(); $timer; } 1 .. 5; DESCRIPTION
The Time::Stopwatch module provides a convenient interface to timing functions through tied scalars. From the point of view of the user, scalars tied to the module simply increase their value by one every second. Using the module should mostly be obvious from the synopsis. You can provide an initial value for the timers either by assigning to them or by passing the value as a third argument to tie(). If you have the module Time::HiRes installed, the timers created by Time::Stopwatch will automatically count fractional seconds. Do not assume that the values of the timers are always integers. You may test the constant "Time::Stopwatch::HIRES" to find out whether high resolution timing is enabled. A note on timing short intervals Time::Stopwatch is primarily designed for timing moderately long intervals (i.e. several seconds), where the overhead imposed by the tie() interface does not matter. With Time::HiRes installed, it can nonetheless be used for even microsecond timing, provided that appropriate care is taken. o Explicitly initialize the timer by assignment. The first measurement taken before resetting the timer will be a few microseconds longer due to the overhead of the tie() call. o Always subtract the overhead of the timing code. This is true in general even if you're not using Time::Stopwatch. (High-level benchmarking tools like Benchmark.pm do this automatically.) See the code example below. o Take as many measurements as you can to minimize random errors. The Statistics::Descriptive module may be useful for analyzing the data. This advice is also true for all benchmarking. o Remember that a benchmark measures the time take to run the benchmark. Any generalizations to real applications may or may not be valid. If you want real world data, profile the real code in real use. The following sample code should give a relatively reasonable measurement of a the time taken by a short operation: use Time::HiRes; # high resolution timing required use Time::Stopwatch; use Statistics::Descriptive; my $stat = Statistics::Descriptive::Sparse->new(); tie my $time, 'Time::Stopwatch'; # code timer tie my $wait, 'Time::Stopwatch'; # loop timer while ($wait < 60) { # run for one minute my $diff = 0; $time = 0; do_whatever(); $diff += $time; $time = 0; $diff -= $time; $stat->add_data($diff); } print("count: ", $stat->count(), " iterations ", "mean: ", $stat->mean(), " seconds ", "s.d.: ", $stat->standard_deviation(), " seconds "); Note that the above code includes the time of the subroutine call in the measurement. BUGS
Since tied scalars do not (yet?) support atomic modification, use of operators like "$t++" or "$t *= 2" on timers will cause them to lose the time it takes to fetch, modify and store the value. I might be able to get around this by overloading the return value of "FETCH", but I doubt if it's worth the trouble. Just don't do that. There is no way to force low-resolution timing if Time::HiRes has been installed. I'm not sure why anyone would want to, since int() will do just fine if you want whole seconds, but still.. CHANGE LOG
1.00 (15 Mar 2001) Explicitly localized $SIG{__DIE__} when testing for Time::HiRes availability. Added "A note on timing short intervals" to the POD documentation. Bumped version to 1, no longer beta. 0.03 (27 Feb 2001) Modified tests to give more information, reduced subsecond accuracy test to 1/10 seconds to allow for inaccurate select() implementations. Tweaked synopsis and README. SEE ALSO
Time::HiRes, "tie" in perlfunc For a higher-level approach to timing, try (among others) the modules Time::SoFar, Devel::Timer, or Benchmark. Also see the profiling modules Devel::DProf, Devel::SmallProf and Devel::OpProf. AUTHORS
Copyright 2000-2001, Ilmari Karonen. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Address bug reports and comments to: perl@itz.pp.sci.fi perl v5.12.3 2001-04-15 Stopwatch(3pm)
All times are GMT -4. The time now is 07:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy