In general, when it comes to a rest period, pilots need to have 12-hours rest, or a length of the preceding duty, if the flight time exceeded 12-hours. If a pilot is on duty for 8 hours, then they need 12 hours rest, however, if they were on duty for 16 hours then their rest period needs to be the same as this.
This time can occasionally be lower, depending on some circumstances, such as when delays occur and the pilot is away from their home base. There is also something called ‘split duties’ which can also be utilized where the crew rest in a hotel while in the middle of a duty. This has the same sort of effect as taking in flight rest as it extends their maximum allowed duty time.
There are other factors that will alter and affect the amount of time a pilot will get to rest, however these are the standard rules that are worked by. It does differ everywhere slightly, especially in different countries, however these are the standards you will often find in both the USA and in most of Europe too. If a pilot exceeds 12-hours of on duty time, they must rest for the same amount of time they were on duty for.