From cae354d299688304f609c5f064702891f02260b9 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Wed, 2 Aug 2017 17:12:28 +0900 Subject: [PATCH] eina hamster count - use a fixed version, revision etc. so builds repro this should help with repdocucable builds by having our hamsters constant for a build of a specific code revision. @fix --- src/lib/eina/eina_hamster.c | 32 ++++++-------------------------- 1 file changed, 6 insertions(+), 26 deletions(-) diff --git a/src/lib/eina/eina_hamster.c b/src/lib/eina/eina_hamster.c index 0cfd808fe2..261713b734 100644 --- a/src/lib/eina/eina_hamster.c +++ b/src/lib/eina/eina_hamster.c @@ -35,8 +35,11 @@ * @cond LOCAL */ -const char *_eina_hamster = VTIME; -static int _eina_hamsters = -1; +static const int _eina_hamster = + (VMAJ * 100 * 100 * 100) + + (VMIN * 100 * 100 ) + + (VMIC * 100 ) + + (VREV ); /** * @endcond @@ -53,30 +56,7 @@ static int _eina_hamsters = -1; EAPI int eina_hamster_count(void) { - if (_eina_hamsters < 0) - { - int hrs = 0, min = 0, sec = 0; - int monnum = 0, day = 0, year = 0; - int zone = 0; - int fields; - - fields = sscanf(_eina_hamster, "%04d-%02d-%02d %02d:%02d:%02d %d", - &year, &monnum, &day, &hrs, &min, &sec, &zone); - if (fields == 7) - { - _eina_hamsters = (hrs * 60) + min; - // alloc 60 for mins, 24 for hrs - // alloc 1-31 (32) for days, 1-12 (13) for months - // use year as-is, for 31 bits (signed) this gives us up to - // 3584 years, which is good enough imho. - 1500 years from - // now or so. :) - _eina_hamsters += - (day + (monnum * 32) + (13 * 32 * year)) * (24 * 60); - } - } - - // format: [rest - year][0-12 - month][0-31 - day][0-23 - hrs][0-59 - sec] - return _eina_hamsters; + return _eina_hamster; } /**