Browse code

set timezone to Europe/Paris

devnewton authored on 01/05/2018 11:19:02
Showing 2 changed files
... ...
@@ -5,7 +5,7 @@ include_once "config.php";
5 5
 function taab_echo_backend($lastId, $room = '', $newPostId = NULL) {
6 6
     global $pdo;
7 7
     $posts = $pdo->prepare(
8
-                    "SELECT id, strftime('%Y%m%d%H%M%S', time) as time, login, info, message
8
+                    "SELECT id, strftime('%s', time) as time, login, info, message
9 9
          FROM posts
10 10
          WHERE id > :lastId
11 11
          and room = :room
... ...
@@ -23,7 +23,7 @@ function taab_echo_backend($lastId, $room = '', $newPostId = NULL) {
23 23
     while($post = $posts->fetch(PDO::FETCH_OBJ)) {
24 24
         fputs($outstream, $post->id);
25 25
         fputs($outstream, "\t");
26
-        fputs($outstream, $post->time);
26
+        fputs($outstream, strftime('%Y%m%d%H%M%S', $post->time));
27 27
         fputs($outstream, "\t");
28 28
         fputs($outstream, $post->info);
29 29
         fputs($outstream, "\t");
... ...
@@ -1,5 +1,7 @@
1 1
 <?php
2 2
 
3
+date_default_timezone_set('Europe/Paris');
4
+
3 5
 $pdo = new PDO('sqlite:./data/backend.db');
4 6
 
5 7
 $pdo->query("CREATE TABLE IF NOT EXISTS posts (