view src/timeconv.c @ 355:d1f930be4711

From Jeffrey Morlan: pst_build_id_ptr and pst_build_desc_ptr require that the first child of a BTree page have the same starting ID as itself. This is not required by the spec, and is not true in many real-world PSTs (presumably, the original first child of the page got deleted). Because of this, many emails are not being extracted from these PSTs. It also triggers an infinite loop in lspst (a separate bug, also fixed)
author Carl Byington <carl@five-ten-sg.com>
date Wed, 06 Jul 2016 10:12:22 -0700
parents e3a46f66332b
children ad7b880ad3d1
line wrap: on
line source

#include "define.h"



char* pst_fileTimeToAscii(const FILETIME* filetime, char* result) {
    time_t t;
    t = pst_fileTimeToUnixTime(filetime);
    return ctime_r(&t, result);
}


void pst_fileTimeToStructTM (const FILETIME *filetime, struct tm *result) {
    time_t t1;
    t1 = pst_fileTimeToUnixTime(filetime);
    gmtime_r(&t1, result);
}


time_t pst_fileTimeToUnixTime(const FILETIME *filetime)
{
    uint64_t t = filetime->dwHighDateTime;
    const uint64_t bias = 11644473600LL;
    t <<= 32;
    t += filetime->dwLowDateTime;
    t /= 10000000;
    t -= bias;
    return ((t > (uint64_t)0x000000007fffffff) && (sizeof(time_t) <= 4)) ? 0 : (time_t)t;
}