2007-01-18 06:13 AM
2007-01-18 02:38 AM
i'm sure there is some simple mistake in this, but i just cannot see it. the problem is that i'm trying to convert seconds to hours as follows - and it just doesn't seem to work.. please help.
hours = (int) ((unsigned long) (byte1 | byte2<bytes contain the seconds value - and the result should be stored as int. simple, but just cannot get it working!2007-01-18 06:13 AM
Found it probably - have to test on CPU though, but at least it now makes more sense and there shouldn't be any casting mistakes anymore.. or?
// create seconds counter contents (125000s) byte1 = 0x48; byte2 = 0xe8; byte3 = 0x01; byte4 = 0; // should result 34h --> i = (int) ( ( (unsigned long) byte1 + (unsigned long) byte2 * 256L + (unsigned long) byte3 * 65536L + (unsigned long) byte4 * 16777216L ) / 3600L );