Flameskulls are interesting creatures in that they combine three traits – they are undead, they have the Spellcasting trait with wizard spells and spell slots, and they are not killed at 0 HP. Rather, they are "destroyed" but Rejuvenate after one hour.
A previous question has asked whether the ‘rejuvination’ restores their spent spell slots and concluded it does not, by the principle of abilities do only what they say they do.
If they must recover their spell slots by rest, do Flameskulls need to sleep to do so? A previous question about undead in general suggested that while their Undead Nature means they are not required to sleep, that does not mean that they cannot sleep. Thus as NPC casters recovering spell slots, (and without access to features like Arcane Recovery or the Lair Action of a Lich that recovers spell slots), Flameskulls would need to take a long rest, which would include voluntarily sleeping.
Suppose a Flameskull is down a few slots and is engaged in rest and possibly sleep to recover them. It is attacked and ‘destroyed’, and then Rejuvenated in an hour.
Does the time that it spent while destroyed…
a) allow it to continue to both rest and sleep, so that it has gained an hour more of each when it is rejuvenated?
b) allow it to continue to rest but not to sleep, so that it has an hour more of rest but not of sleep when it is rejuvenated?
c) not permit it to either rest or sleep, but not remove any time for these it had already ‘accumulated’? (It is thus ‘paused’ for an hour)
d) ‘interrupt’ both its rest and sleep, so that even if it had hours of these banked, it has to start over upon rejuvenation?
For reference, from the PHB errata:
A long rest is a period of extended downtime, at least 8 hours long, during which a [creature] sleeps for at least 6 hours and performs no more than 2 hours of light activity, such as reading, talking, eating, or standing watch.”
From the PHB
If the rest is interrupted by a period of strenuous activity—at least 1 hour of walking, fighting, casting spells, or similar adventuring activity— the [creatures] must begin the rest again to gain any benefit from it…a [creature] must have at least 1 hit point at the start of the rest to gain its benefits.
Note that ‘being destroyed’ is not explicitly one of the ‘similar adventuring activities’ that interrupts a rest. The requirement of having at least one hit point would rule out the Flameskull starting its long rest immediately upon being destroyed, but does not explicitly prevent one from continuing a long rest if it had already begun one when it was destroyed.
Note that, unlike rest, "sleep" is not a game-defined condition, but a state that is meant to be intuitively adjucated on the fly (DMG p. 248).