summaryrefslogtreecommitdiff
path: root/typing-break
diff options
context:
space:
mode:
authorrbuj <[email protected]>2020-03-03 13:15:37 +0100
committerraveit65 <[email protected]>2020-03-11 10:53:51 +0100
commitb43972d86c8dee68c5511a1b4abb2013f4d69176 (patch)
tree31f5deecd491f03d138da70ca48b8094df7f102e /typing-break
parent8e819d3a5b4b950574a0b1e74e09803151358679 (diff)
downloadmate-control-center-b43972d86c8dee68c5511a1b4abb2013f4d69176.tar.bz2
mate-control-center-b43972d86c8dee68c5511a1b4abb2013f4d69176.tar.xz
typing-break: Remove warning ‘GTimeVal’ is deprecated
Diffstat (limited to 'typing-break')
-rw-r--r--typing-break/drw-timer.c10
-rw-r--r--typing-break/drw-timer.h2
2 files changed, 5 insertions, 7 deletions
diff --git a/typing-break/drw-timer.c b/typing-break/drw-timer.c
index a757911e..fc7cc104 100644
--- a/typing-break/drw-timer.c
+++ b/typing-break/drw-timer.c
@@ -23,7 +23,7 @@
struct _DrwTimer
{
- GTimeVal start_time;
+ gint64 start_time;
};
DrwTimer * drw_timer_new (void)
@@ -35,14 +35,12 @@ DrwTimer * drw_timer_new (void)
void drw_timer_start (DrwTimer *timer)
{
- g_get_current_time (&timer->start_time);
+ timer->start_time = g_get_real_time ();
}
-double drw_timer_elapsed (DrwTimer *timer)
+gint drw_timer_elapsed (DrwTimer *timer)
{
- GTimeVal now;
- g_get_current_time (&now);
- return now.tv_sec - timer->start_time.tv_sec;
+ return (g_get_real_time () - timer->start_time) / G_USEC_PER_SEC;
}
void drw_timer_destroy (DrwTimer *timer)
diff --git a/typing-break/drw-timer.h b/typing-break/drw-timer.h
index 428d9480..a9ab2ea7 100644
--- a/typing-break/drw-timer.h
+++ b/typing-break/drw-timer.h
@@ -36,7 +36,7 @@
typedef struct _DrwTimer DrwTimer;
DrwTimer * drw_timer_new (void);
void drw_timer_start (DrwTimer *timer);
-double drw_timer_elapsed (DrwTimer *timer);
+gint drw_timer_elapsed (DrwTimer *timer);
void drw_timer_destroy (DrwTimer *timer);
#endif /* __DRW_TIMER_H__ */