summaryrefslogtreecommitdiff
path: root/src/lib/embryo/embryo_time.c
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2016-02-22 12:16:16 -0500
committerMike Blumenkrantz <zmike@osg.samsung.com>2016-02-22 18:29:01 -0500
commit3af1a8af1e76701d2204a8b3307cd80abce47efc (patch)
treece512b1ac6e86afb66ebb15eb3a45b731ac423ed /src/lib/embryo/embryo_time.c
parenta0ad57bb16545c2aa5b1a153c97e0ca1b675e6b9 (diff)
embryo: reformat the whole thing
so many tabs
Diffstat (limited to '')
-rw-r--r--src/lib/embryo/embryo_time.c62
1 files changed, 31 insertions, 31 deletions
diff --git a/src/lib/embryo/embryo_time.c b/src/lib/embryo/embryo_time.c
index 8725377b0c..2caab43290 100644
--- a/src/lib/embryo/embryo_time.c
+++ b/src/lib/embryo/embryo_time.c
@@ -27,9 +27,9 @@
27static Embryo_Cell 27static Embryo_Cell
28_embryo_time_seconds(Embryo_Program *ep EINA_UNUSED, Embryo_Cell *params EINA_UNUSED) 28_embryo_time_seconds(Embryo_Program *ep EINA_UNUSED, Embryo_Cell *params EINA_UNUSED)
29{ 29{
30 struct timeval timev; 30 struct timeval timev;
31 double t; 31 double t;
32 float f; 32 float f;
33 33
34 gettimeofday(&timev, NULL); 34 gettimeofday(&timev, NULL);
35 t = (double)(timev.tv_sec - ((timev.tv_sec / (60 * 60 * 24)) * (60 * 60 * 24))) 35 t = (double)(timev.tv_sec - ((timev.tv_sec / (60 * 60 * 24)) * (60 * 60 * 24)))
@@ -41,10 +41,10 @@ _embryo_time_seconds(Embryo_Program *ep EINA_UNUSED, Embryo_Cell *params EINA_UN
41static Embryo_Cell 41static Embryo_Cell
42_embryo_time_date(Embryo_Program *ep, Embryo_Cell *params) 42_embryo_time_date(Embryo_Program *ep, Embryo_Cell *params)
43{ 43{
44 static time_t last_tzset = 0; 44 static time_t last_tzset = 0;
45 struct timeval timev; 45 struct timeval timev;
46 struct tm *tm; 46 struct tm *tm;
47 time_t tt; 47 time_t tt;
48 48
49 if (params[0] != (8 * sizeof(Embryo_Cell))) return 0; 49 if (params[0] != (8 * sizeof(Embryo_Cell))) return 0;
50 gettimeofday(&timev, NULL); 50 gettimeofday(&timev, NULL);
@@ -52,35 +52,34 @@ _embryo_time_date(Embryo_Program *ep, Embryo_Cell *params)
52 if ((tt > (last_tzset + 1)) || 52 if ((tt > (last_tzset + 1)) ||
53 (tt < (last_tzset - 1))) 53 (tt < (last_tzset - 1)))
54 { 54 {
55 last_tzset = tt; 55 last_tzset = tt;
56 tzset(); 56 tzset();
57 } 57 }
58 tm = localtime(&tt); 58 tm = localtime(&tt);
59 if (tm) 59 if (tm)
60 { 60 {
61 Embryo_Cell *cptr; 61 Embryo_Cell *cptr;
62 double t; 62 double t;
63 float f; 63 float f;
64
65 cptr = embryo_data_address_get(ep, params[1]);
66 if (cptr) *cptr = tm->tm_year + 1900;
67 cptr = embryo_data_address_get(ep, params[2]);
68 if (cptr) *cptr = tm->tm_mon + 1;
69 cptr = embryo_data_address_get(ep, params[3]);
70 if (cptr) *cptr = tm->tm_mday;
71 cptr = embryo_data_address_get(ep, params[4]);
72 if (cptr) *cptr = tm->tm_yday;
73 cptr = embryo_data_address_get(ep, params[5]);
74 if (cptr) *cptr = (tm->tm_wday + 6) % 7;
75 cptr = embryo_data_address_get(ep, params[6]);
76 if (cptr) *cptr = tm->tm_hour;
77 cptr = embryo_data_address_get(ep, params[7]);
78 if (cptr) *cptr = tm->tm_min;
79 cptr = embryo_data_address_get(ep, params[8]);
80 t = (double)tm->tm_sec + (((double)timev.tv_usec) / 1000000);
81 f = (float)t;
82 if (cptr) *cptr = EMBRYO_FLOAT_TO_CELL(f);
83 64
65 cptr = embryo_data_address_get(ep, params[1]);
66 if (cptr) *cptr = tm->tm_year + 1900;
67 cptr = embryo_data_address_get(ep, params[2]);
68 if (cptr) *cptr = tm->tm_mon + 1;
69 cptr = embryo_data_address_get(ep, params[3]);
70 if (cptr) *cptr = tm->tm_mday;
71 cptr = embryo_data_address_get(ep, params[4]);
72 if (cptr) *cptr = tm->tm_yday;
73 cptr = embryo_data_address_get(ep, params[5]);
74 if (cptr) *cptr = (tm->tm_wday + 6) % 7;
75 cptr = embryo_data_address_get(ep, params[6]);
76 if (cptr) *cptr = tm->tm_hour;
77 cptr = embryo_data_address_get(ep, params[7]);
78 if (cptr) *cptr = tm->tm_min;
79 cptr = embryo_data_address_get(ep, params[8]);
80 t = (double)tm->tm_sec + (((double)timev.tv_usec) / 1000000);
81 f = (float)t;
82 if (cptr) *cptr = EMBRYO_FLOAT_TO_CELL(f);
84 } 83 }
85 return 0; 84 return 0;
86} 85}
@@ -91,5 +90,6 @@ void
91_embryo_time_init(Embryo_Program *ep) 90_embryo_time_init(Embryo_Program *ep)
92{ 91{
93 embryo_program_native_call_add(ep, "seconds", _embryo_time_seconds); 92 embryo_program_native_call_add(ep, "seconds", _embryo_time_seconds);
94 embryo_program_native_call_add(ep, "date", _embryo_time_date); 93 embryo_program_native_call_add(ep, "date", _embryo_time_date);
95} 94}
95