Tag: timestamp

Unix时间戳到FAT时间戳

我试图将时间结构转换为FAT时间戳。 我的代码看起来像: unsigned long Fat(tm_struct pTime) { unsigned long FatTime = 0; FatTime |= (pTime.seconds / 2) >> 1; FatTime |= (pTime.minutes) << 5; FatTime |= (pTime.hours) << 11; FatTime |= (pTime.days) << 16; FatTime |= (pTime.months) << 21; FatTime |= (pTime.years + 20) << 25; return FatTime; } 有人有正确的代码吗?