This "dying gasp" seems to be a standard term in some games, but also in networking
terms.
Dying Gasp resides on a hardware component on the High-performance
WAN Interface Card (HWIC) and supports the Fast Ethernet and Gigabit Ethernet interfaces.
The networking devices rely on a temporary back-up power supply on a capacitor,
that allows for a graceful shutdown and the generation of the dying-gasp message.
This temporary power supply is designed to last from 10 to 20 milliseconds to perform
these tasks. Dying-Gasp packets are created when you configure the host by using the
dying-gasp configuration command. The show dying-gasp packets command displays
the detailed information about the created packets.
The SNMP server for the SNMP Dying Gasp message is specified through the snmp-server
hostconfiguration command. The syslog server sending the syslog Dying Gasp message
is specified through the logging host hostname-or-ipaddress transport udp command.
The Ethernet-OAM Dying Gasp packets are created for interfaces where Ethernet-OAM
is enabled.
Source:
https://www.cisco.com/c/en/us/td/docs/switches/connectedgrid/cgs2520/software/release/15_0_2_ed/configuration/guide/cgs_15_0_2ed/cgs_dying_gasp.pdf (https://www.cisco.com/c/en/us/td/docs/switches/connectedgrid/cgs2520/software/release/15_0_2_ed/configuration/guide/cgs_15_0_2ed/cgs_dying_gasp.pdf)
20ms is not much. It's just one period of the AC Mains.
Mains powered SMPS circuits usually start by rectifying the mains voltage and charging a 400Vdc Electrolytic capacitor, which holds a significant charge. Just take any Power adapter with a Led in it, and watch how long it takes before the LED goes out after you pull the plug out of the wall.
The only extra thing required would then be some detection that AC voltage input is lost, and communicate it in a timely fashion to the electronics.