\hypertarget{ecore_time_functions_example_8c-example}{}\section{ecore\+\_\+time\+\_\+functions\+\_\+example.\+c}
Shows the difference between the three time functions. See \mbox{\hyperlink{ecore_time_functions_example_c}{the example explained}}.


\begin{DoxyCodeInclude}
\textcolor{comment}{//Compile with:}
\textcolor{comment}{// gcc -o ecore\_time\_functions\_example ecore\_time\_functions\_example.c `pkg-config --libs --cflags ecore`}

\textcolor{preprocessor}{#include <Ecore.h>}
\textcolor{preprocessor}{#include <unistd.h>}

\textcolor{keyword}{static} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}
\_timer\_cb(\textcolor{keywordtype}{void} *data \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})
\{
   printf(\textcolor{stringliteral}{"ecore time: %0.3f\(\backslash\)n"}, \mbox{\hyperlink{group__Ecore__Time__Group_ga98f2439b5d3e7114a75bfe2f0c22c4e9}{ecore\_time\_get}}());
   printf(\textcolor{stringliteral}{"loop time: %0.3f\(\backslash\)n"}, \mbox{\hyperlink{group__Ecore__Time__Group_gab53d952cc4c2f3ed032d535b307c43bd}{ecore\_loop\_time\_get}}());
   printf(\textcolor{stringliteral}{"unix time: %0.3f\(\backslash\)n"}, \mbox{\hyperlink{group__Ecore__Time__Group_ga0b8030aa39eb3701b6b30816ee9c45df}{ecore\_time\_unix\_get}}());
   printf(\textcolor{stringliteral}{"\(\backslash\)nSleep for 1 second...\(\backslash\)n\(\backslash\)n"});
   sleep(1);
   printf(\textcolor{stringliteral}{"ecore time: %0.3f\(\backslash\)n"}, \mbox{\hyperlink{group__Ecore__Time__Group_ga98f2439b5d3e7114a75bfe2f0c22c4e9}{ecore\_time\_get}}());
   printf(\textcolor{stringliteral}{"loop time: %0.3f\(\backslash\)n"}, \mbox{\hyperlink{group__Ecore__Time__Group_gab53d952cc4c2f3ed032d535b307c43bd}{ecore\_loop\_time\_get}}());
   printf(\textcolor{stringliteral}{"unix time: %0.3f\(\backslash\)n"}, \mbox{\hyperlink{group__Ecore__Time__Group_ga0b8030aa39eb3701b6b30816ee9c45df}{ecore\_time\_unix\_get}}());

   \mbox{\hyperlink{group__Ecore__Main__Loop__Group_ga95cf8e97dff0716433c2c5474d606a98}{ecore\_main\_loop\_quit}}();

   \textcolor{keywordflow}{return} \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}};
\}

\textcolor{keywordtype}{int}
main(\textcolor{keywordtype}{void})
\{
   \textcolor{keywordflow}{if} (!\mbox{\hyperlink{group__Ecore__Init__Group_ga77757609684a2c922dc5ec398274751b}{ecore\_init}}())
     \{
        printf(\textcolor{stringliteral}{"ERROR: Cannot init Ecore!\(\backslash\)n"});
        \textcolor{keywordflow}{return} -1;
     \}

   \mbox{\hyperlink{group__Ecore__Timer__Group_ga7b9cb9d24ecebfdbb957436e2e669402}{ecore\_timer\_add}}(0.1, \_timer\_cb, NULL);
   \mbox{\hyperlink{group__Ecore__Main__Loop__Group_gaf103b9f668bb3e4fed12e52c6180132d}{ecore\_main\_loop\_begin}}();
   \mbox{\hyperlink{group__Ecore__Init__Group_ga768298b932f18d7e7593a447493e5cde}{ecore\_shutdown}}();
\}

\end{DoxyCodeInclude}
 