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
This commit is contained in:
Carsten Haitzler 2017-08-02 17:12:28 +09:00
parent 886fb0a782
commit cae354d299
1 changed files with 6 additions and 26 deletions

View File

@ -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;
}
/**