A certain percentage of your bar goes up for however long you have been in a sanctuary.

I would love to say it is a full bar for 24 hours, but that would seem too simple.

It's the bar, nothing more, which can be shown easily by switching from a high job to a low one, the percentage of the bar stays the same.

As a result, you benefit more from using rested exp on a higher job, because you gain more exp over the length of the bar.