Where have I gone wrong with my int maths?

Hi,
if "duration" is less than 1000000 the integer division (duration/1000000) will be always 0 (because the result of an integer division is not automatically converted in a float value).
You could modify the order of operations, if you are sure that (gyro_z*duration) does not exceed the maximum value of a long variable:

gyroang_z= gyroang_z + (gyro_z*duration)/1000000;