/[dtapublic]/to_be_filed/webprojs/php_libraries/php_library/fboprime/timeraw.inc
ViewVC logotype

Contents of /to_be_filed/webprojs/php_libraries/php_library/fboprime/timeraw.inc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 35 - (show annotations) (download)
Sat Oct 8 23:35:33 2016 UTC (6 years, 3 months ago) by dashley
File size: 2946 byte(s)
Initial commit.
1 <?php
2 //$Header: /hl/cvsroots/gpl01/gpl01/webprojs/fboprime/sw/phplib/timeraw.inc,v 1.4 2006/04/10 22:48:02 dashley Exp $
3 //********************************************************************************
4 //Copyright (C) 2006 David T. Ashley
5 //********************************************************************************
6 //This program or source file is free software; you can redistribute it and/or
7 //modify it under the terms of the GNU General Public License as published by
8 //the Free Software Foundation; either version 2 of the License, or (at your
9 //option) any later version.
10 //
11 //This program or source file is distributed in the hope that it will
12 //be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 //GNU General Public License for more details.
15 //
16 //You may have received a copy of the GNU General Public License
17 //along with this program; if not, write to the Free Software
18 //Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 //********************************************************************************
20 //Dave Ashley, 04/06
21 //
22 //This source file provides raw time related code. This file is a wrapper
23 //around the built-in PHP functions to provide more flexibility as we get
24 //near the Unix epoch. All functions that obtain from the machine time must
25 //go through this module.
26 //
27 //--------------------------------------------------------------------------------
28 //Returns the current Unix time as an array of:
29 // a)A decimal string representing the seconds since the Unix epoch. A string
30 // representation is used because then this function can be modified as the
31 // Unix epoch grows closer (but, we'll probably all be using 64-bit machines
32 // by then). The string representation must not exceed 11 characters (but
33 // this should not be a problem until after 5,000 A.D.).
34 //
35 // b)An integer representing the nanoseconds of the fractional part of the
36 // Unix time. An integer is used because the fractional part of the time
37 // is not affected by the Unix epoch issue.
38 //
39 //
40 function TIMERAW_time_precision_mixed_array_2()
41 {
42 //Get the high-precision time microseconds and seconds.
43 list($usec, $sec) = explode(" ", microtime());
44
45 //Convert the integer seconds time to a string.
46 $string_sec = sprintf("%d", $sec);
47
48 //Convert the microseconds to an integer giving the
49 //integer number of microseconds. The original value is in fractional
50 //seconds (a float).
51 $usec = $usec * 1000000.0;
52 $usec = (int) $usec;
53
54 //Convert microseconds to nanoseconds.
55 $nsec = $usec * 1000;
56
57 //Stuff the return array and return.
58 $rv[0] = (string) $string_sec;
59 $rv[1] = (int) $nsec;
60 return($rv);
61 }
62 //--------------------------------------------------------------------------------
63 ?>

dashley@gmail.com
ViewVC Help
Powered by ViewVC 1.1.25