I imagine they used a system similar to the Navy.
Here's a link for more details;
Also there was a TNG episode that mentions this. I don't know all the episode names like you guys but it was the one where Cpt Picard goes off on a mission and the Enterprise gets a new Captain. The new Captain changes the duty rotation and Riker complains to him about it going from an 8 hour shift to a 12 hour shift.