Some slight modification to the format:
Code:
#include <stdio.h>
int array[] =
{0x00000000,
0x1fa42c33,
0x1c202c33,
0x189c2c33,
0x15182c33,
0x11942c33,
0x0e102c33,
0x0a8c2c33,
0x07082c33,
0x03842c33,
0x00002c33,
0x50dc2c32,
};
union timestamp {
int tdate;
struct {
unsigned day:5;
unsigned month:4;
unsigned year: 4;
unsigned :1;
unsigned seconds: 17;
} bits;
};
void swap(unsigned char &a, unsigned char &b)
{
unsigned char t;
t = a;
a = b;
b = t;
}
void byteswap(int &t)
{
unsigned char *x = (unsigned char *)&t;
swap(x[0], x[3]);
swap(x[1], x[2]);
}
int main(void)
{
int i;
timestamp tt;
for(i = 1; i < 12; i++)
{
tt.tdate = array[i];
printf("%04d-%02d-%02d %02d:%02d:%02d\n", tt.bits.year+2001, tt.bits.month, tt.bits.day,
tt.bits.seconds / 3600, (tt.bits.seconds % 3600) / 60, tt.bits.seconds % 60);
}
return 0;
}
Gives this output:
Code:
2007-01-19 09:00:00
2007-01-19 08:00:00
2007-01-19 07:00:00
2007-01-19 06:00:00
2007-01-19 05:00:00
2007-01-19 04:00:00
2007-01-19 03:00:00
2007-01-19 02:00:00
2007-01-19 01:00:00
2007-01-19 00:00:00
2007-01-18 23:00:00