MCPcopy Create free account
hub / github.com/CyanogenMod/android_frameworks_base / setModWhen

Method setModWhen

tools/aapt/ZipEntry.cpp:357–387  ·  view source on GitHub ↗

* Set the CDE/LFH timestamp from UNIX time. */

Source from the content-addressed store, hash-verified

355 * Set the CDE/LFH timestamp from UNIX time.
356 */
357void ZipEntry::setModWhen(time_t when)
358{
359#ifdef HAVE_LOCALTIME_R
360 struct tm tmResult;
361#endif
362 time_t even;
363 unsigned short zdate, ztime;
364
365 struct tm* ptm;
366
367 /* round up to an even number of seconds */
368 even = (time_t)(((unsigned long)(when) + 1) & (~1));
369
370 /* expand */
371#ifdef HAVE_LOCALTIME_R
372 ptm = localtime_r(&even, &tmResult);
373#else
374 ptm = localtime(&even);
375#endif
376
377 int year;
378 year = ptm->tm_year;
379 if (year < 80)
380 year = 80;
381
382 zdate = (year - 80) << 9 | (ptm->tm_mon+1) << 5 | ptm->tm_mday;
383 ztime = ptm->tm_hour << 11 | ptm->tm_min << 5 | ptm->tm_sec >> 1;
384
385 mCDE.mLastModFileTime = mLFH.mLastModFileTime = ztime;
386 mCDE.mLastModFileDate = mLFH.mLastModFileDate = zdate;
387}
388
389
390/*

Callers 1

addCommonMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected