summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlastair Poole <netstar@gmail.com>2021-07-25 22:24:22 +0100
committerAlastair Poole <netstar@gmail.com>2021-07-25 22:24:22 +0100
commit1d72f5e4ba9546a926637fe3c6454c5a079d66f1 (patch)
treece8cfab5ad2e5b942aeea684f8d1270e640be936
parentf556269d441b80c821eb2ce0cb16f249d6b6c831 (diff)
time:
-rw-r--r--src/bin/client/Client.h3
-rw-r--r--src/bin/client/client.c5
-rw-r--r--src/bin/client/main.c7
-rw-r--r--src/tests/client_example.c7
4 files changed, 18 insertions, 4 deletions
diff --git a/src/bin/client/Client.h b/src/bin/client/Client.h
index 3e5aaf5..d11b7c7 100644
--- a/src/bin/client/Client.h
+++ b/src/bin/client/Client.h
@@ -140,6 +140,9 @@ client_del(Client *client);
140Client * 140Client *
141client_add(void); 141client_add(void);
142 142
143uint32_t
144client_event_time(Client *client);
145
143void 146void
144client_follow_enabled_set(Client *client, Eina_Bool enabled); 147client_follow_enabled_set(Client *client, Eina_Bool enabled);
145 148
diff --git a/src/bin/client/client.c b/src/bin/client/client.c
index 79fc76d..3a46340 100644
--- a/src/bin/client/client.c
+++ b/src/bin/client/client.c
@@ -1464,3 +1464,8 @@ client_replay_time_end_set(Client *client, uint32_t secs)
1464 client->replay.end_time = secs; 1464 client->replay.end_time = secs;
1465} 1465}
1466 1466
1467uint32_t
1468client_event_time(Client *client)
1469{
1470 return client->header.time;
1471}
diff --git a/src/bin/client/main.c b/src/bin/client/main.c
index 8eef273..c53d9e6 100644
--- a/src/bin/client/main.c
+++ b/src/bin/client/main.c
@@ -7,8 +7,11 @@ static void
7cb_event_change(Client *client, Snapshot *s, void *data) 7cb_event_change(Client *client, Snapshot *s, void *data)
8{ 8{
9 char buf[32]; 9 char buf[32];
10 struct tm *tm_out = localtime((time_t *) &s->time); 10 struct tm tm_out;
11 strftime(buf, sizeof(buf) - 1, "%Y-%m-%d %H:%M:%S", tm_out); 11 time_t t = (time_t) s->time;
12
13 localtime_r((time_t *) &t, &tm_out);
14 strftime(buf, sizeof(buf) - 1, "%Y-%m-%d %H:%M:%S", &tm_out);
12 15
13 printf("%s\n", buf); 16 printf("%s\n", buf);
14 17
diff --git a/src/tests/client_example.c b/src/tests/client_example.c
index 8eef273..c53d9e6 100644
--- a/src/tests/client_example.c
+++ b/src/tests/client_example.c
@@ -7,8 +7,11 @@ static void
7cb_event_change(Client *client, Snapshot *s, void *data) 7cb_event_change(Client *client, Snapshot *s, void *data)
8{ 8{
9 char buf[32]; 9 char buf[32];
10 struct tm *tm_out = localtime((time_t *) &s->time); 10 struct tm tm_out;
11 strftime(buf, sizeof(buf) - 1, "%Y-%m-%d %H:%M:%S", tm_out); 11 time_t t = (time_t) s->time;
12
13 localtime_r((time_t *) &t, &tm_out);
14 strftime(buf, sizeof(buf) - 1, "%Y-%m-%d %H:%M:%S", &tm_out);
12 15
13 printf("%s\n", buf); 16 printf("%s\n", buf);
14 17