Im trying to convert a time structure to a FAT timestamp. My code looks like:
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;
}
Does someone have the correct code?