EFL core migration @74576
[framework/uifw/ecore.git] / src / examples / ecore_timer_example.c
index 2d5d368..bafeacb 100644 (file)
@@ -9,20 +9,21 @@
 #define TIMEOUT_6 18.0 // top timer1 and start timer7 and timer8 with changed precision
 #define TIMEOUT_7 1.1 // interval for timer7
 #define TIMEOUT_8 1.2 // interval for timer8
-#define DELAY_1 3.0 // delay time for timer1 - used by timer2
+#define DELAY_1   3.0 // delay time for timer1 - used by timer2
 #define INTERVAL1 2.0 // new interval for timer1 - used by timer5
 
 static double _initial_time = 0;
 
-struct context { // helper struct to give some context to the callbacks
-     Ecore_Timer *timer1;
-     Ecore_Timer *timer2;
-     Ecore_Timer *timer3;
-     Ecore_Timer *timer4;
-     Ecore_Timer *timer5;
-     Ecore_Timer *timer6;
-     Ecore_Timer *timer7;
-     Ecore_Timer *timer8;
+struct context   // helper struct to give some context to the callbacks
+{
+   Ecore_Timer *timer1;
+   Ecore_Timer *timer2;
+   Ecore_Timer *timer3;
+   Ecore_Timer *timer4;
+   Ecore_Timer *timer5;
+   Ecore_Timer *timer6;
+   Ecore_Timer *timer7;
+   Ecore_Timer *timer8;
 };
 
 static double
@@ -43,8 +44,8 @@ _timer2_cb(void *data)
 {
    struct context *ctxt = data;
    printf("Timer2 expired after %0.3f seconds. "
-         "Adding delay of %0.3f seconds to timer1.\n",
-         _get_current_time(), DELAY_1);
+          "Adding delay of %0.3f seconds to timer1.\n",
+          _get_current_time(), DELAY_1);
 
    ecore_timer_delay(ctxt->timer1, DELAY_1);
 
@@ -57,7 +58,7 @@ _timer3_cb(void *data)
 {
    struct context *ctxt = data;
    printf("Timer3 expired after %0.3f seconds. "
-         "Freezing timer1.\n", _get_current_time());
+          "Freezing timer1.\n", _get_current_time());
 
    ecore_timer_freeze(ctxt->timer1);
 
@@ -70,8 +71,8 @@ _timer4_cb(void *data)
 {
    struct context *ctxt = data;
    printf("Timer4 expired after %0.3f seconds. "
-         "Resuming timer1, which has %0.3f seconds left to expire.\n",
-         _get_current_time(), ecore_timer_pending_get(ctxt->timer1));
+          "Resuming timer1, which has %0.3f seconds left to expire.\n",
+          _get_current_time(), ecore_timer_pending_get(ctxt->timer1));
 
    ecore_timer_thaw(ctxt->timer1);
 
@@ -86,8 +87,8 @@ _timer5_cb(void *data)
    double interval = ecore_timer_interval_get(ctxt->timer1);
 
    printf("Timer5 expired after %0.3f seconds. "
-         "Changing interval of timer1 from %0.3f to %0.3f seconds.\n",
-         _get_current_time(), interval, INTERVAL1);
+          "Changing interval of timer1 from %0.3f to %0.3f seconds.\n",
+          _get_current_time(), interval, INTERVAL1);
 
    ecore_timer_interval_set(ctxt->timer1, INTERVAL1);
 
@@ -127,7 +128,7 @@ _timer6_cb(void *data)
    ctxt->timer1 = NULL;
 
    printf("Starting timer7 (%0.3fs) and timer8 (%0.3fs).\n",
-         TIMEOUT_7, TIMEOUT_8);
+          TIMEOUT_7, TIMEOUT_8);
 
    ctxt->timer7 = ecore_timer_add(TIMEOUT_7, _timer7_cb, ctxt);
    ctxt->timer8 = ecore_timer_add(TIMEOUT_8, _timer8_cb, ctxt);
@@ -138,14 +139,15 @@ _timer6_cb(void *data)
    return ECORE_CALLBACK_CANCEL;
 }
 
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
 {
    struct context ctxt = {0};
 
    if (!ecore_init())
      {
-       printf("ERROR: Cannot init Ecore!\n");
-       return -1;
+        printf("ERROR: Cannot init Ecore!\n");
+        return -1;
      }
 
    _initial_time = ecore_time_get();
@@ -182,3 +184,4 @@ int main(int argc, char **argv)
 
    return 0;
 }
+