1 |
<?php
|
2 |
//$Header: /hl/cvsroots/gpl01/gpl01/webprojs/fboprime/sw/phplib/stime.inc,v 1.3 2006/07/29 04:49:18 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, 07/06
|
21 |
//
|
22 |
//This source file contains date and time calculation and
|
23 |
//manipulation functions.
|
24 |
//
|
25 |
require_once("config.inc"); //Scheduling configuration.
|
26 |
require_once("confighard.inc"); //Necessary for date minimums and maximums.
|
27 |
require_once("t4.inc");
|
28 |
//
|
29 |
//--------------------------------------------------------------------------------
|
30 |
//Creates an STIME (low resolution) from year, month, day, hour, and minute
|
31 |
//passed (as integers). Seconds and smaller time units all set to zero.
|
32 |
//
|
33 |
function STIME_stime_make_medres($year_in, $month_in, $day_in, $hour_in, $minute_in)
|
34 |
{
|
35 |
$rv = "ST"
|
36 |
.
|
37 |
sprintf("%04d%02d%02d%02d%02d", $year_in, $month_in, $day_in, $hour_in, $minute_in)
|
38 |
.
|
39 |
"00000000";
|
40 |
return($rv);
|
41 |
}
|
42 |
//
|
43 |
//--------------------------------------------------------------------------------
|
44 |
//Background on the functions below ... there are 48 half-hour time slots in
|
45 |
//a day, which we index 0 .. 47. This provides the mappings back and forth
|
46 |
//between an STIME or fraction of an STIME and the integers.
|
47 |
//
|
48 |
//The integers are more machine-efficient.
|
49 |
//
|
50 |
//--------------------------------------------------------------------------------
|
51 |
//Maps from the embedded T4 (HHMM) to the integer representing the half-hour
|
52 |
//interval (0..47).
|
53 |
//
|
54 |
function STIME_T4_lb_int($stime_in)
|
55 |
{
|
56 |
$extract = SubStr($stime_in, 10, 4);
|
57 |
$rv = T4_lb_int($extract);
|
58 |
return($rv);
|
59 |
}
|
60 |
//
|
61 |
//--------------------------------------------------------------------------------
|
62 |
//End of $RCSfile: stime.inc,v $.
|
63 |
//--------------------------------------------------------------------------------
|
64 |
?>
|