What it seems today it can not seem tomorrow :-).
You should have been allowed to use date and time related commands on /boot/grub/grub.cfg editing /etc/grub.d even if they should rely on the internal PC clock, that has to be protected from users under both OSes and BIOS, as well as the possibility to boot from sources different from those two. Moreover remember that a failure of the motherboard battery may lead to a corrupt time shown by the internal clock.
Give it a look on this ubuntu thread for some more practical hints or to this post for a simple panorama. Hint relays on the datehook module and the config file (/boot/grub/grub.cfg)
insmod datehook
if [ "$HOUR" -ge "8" -a "$HOUR" -lt "13" ]; then set default="0" #Manjaro KDE
else set default="1" #Elementary OS
fi
By hands
If you cannot use the grub features above, you can apply a strategy
to preempt the logging in the wrong time forcing a reboot with a specific selection as described in these other answers. You should put a time check in a script that has to be executed on boot. If the check is not passed you should force a reboot with a different grub option.
Main steps are:
- in the
/etc/default/grub write/check GRUB_DEFAULT=saved
- Use
grub-set-default(if you want) for the willed boot option
sudo update-grub to save it
In the script to be run
grub-reboot <entry> with that points to the other OS.
kicking out the people still logged in when it will arrive a black time window, e.g. following the suggestion of davidgo adding a check in the crontab (but again I think it is better to write a little script that reboots with the willed grub option or if it works directly grub-reboot <entry>).
Have a nice reading and trying time...