diff --git a/Connections/database_functions.php b/Connections/database_functions.php index d81e229..aea0903 100644 --- a/Connections/database_functions.php +++ b/Connections/database_functions.php @@ -483,11 +483,22 @@ function currency_format($value, $places = 2){ // Time zones must be setup in mysql for this to work: mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql set_time_zone(); function set_time_zone() { - global $database_YBDB, $YBDB; - - mysql_select_db($database_YBDB, $YBDB); - $query = "SET time_zone='" . TIMEZONE . "';"; - $Recordset1 = mysql_query($query, $YBDB) or die(mysql_error()); + global $database_YBDB, $YBDB; + + mysql_select_db($database_YBDB, $YBDB); + $query = "SET time_zone='" . TIMEZONE . "';"; + $Recordset1 = mysql_query($query, $YBDB); + + $error = "
YBDB relies heavily on accurate time calculations.
" . + "Make sure you have installed time zone support for mysql or mariadb as explained " .
+ 'here.
' .
+ "In GNU/Linux you run the mysql_tzinfo_to_sql program from the commandline:
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql.
";
+
+ if(!$Recordset1) {
+ echo mysql_error() . "\n" . $error;
+ }
+
}
//function to convert server time to local time. To be used by all other current date / time requests.
@@ -584,6 +595,12 @@ function list_15min($start_time, $start_offset_min, $form_name, $hours, $display
}
// replacement for the hardwired list_min15()
+// $start_time = time_in
+// $start_offset_min = 0
+// $form_name = time_out
+// $hours = 0
+// $display_elapsed_hours = 1
+// $default_value = $row_Recordset1['time_out']
function list_min($start_time, $start_offset_min, $form_name, $hours, $display_elapsed_hours, $default_value, $min=15){
list($date, $time) = split('[ ]', $start_time);
list($Y, $m, $d) = split('[-]', $date);