Under FAA rules of you hold a PIC type rating ( not an SIC only type rating) you can log PIC for the time you are the Pilot Flying.
So the Captain logs PIC for the entire duration of the flight including the time he is asleep.
The FO will log PIC for the time he or she is the PF.
It really is that simple.