DS3231 RTC interrupting sleep mode for different time intervals

Hi. I'm working on a project that will allow me to lower the power consumption of arduino mega board connected with a gsm and sd card shield. In line with that, I plan on using the DS3231 RTC to wake the board from sleeping instead of using the watchdog timer (since it is being used by other components).

However, all I saw when researching are codes that are already time-fixed in waking arduino boards for a specific time (alarm clock scheme) like waking up every 8AM, or every minute etc.

My codes are composed of sleeping time intervals like 1s, 8s etc. So what can be done to have these lines of codes substituted by the interrupt coming from the DS3231 rtc?

TIA

Confused, so your saying you don’t know how to modify the library so you can set the alarm to anytime you want. Even just 8 seconds from now.

Read more..maybe this will help.
https://gist.github.com/JChristensen/0359516e3780a819cbffef0db5419213

No. I'm thinking I could substitute other lines for the delay() functions. I have used this function several times in the code, with varying duration in the arguments like delay(2000), delay(5000) etc.

I'm thinking of using the low power library to activate the sleep mode instead of the delay functions:

LowPower.powerDown(SLEEP_2S, ADC_OFF, BOD_OFF );
LowPower.powerDown(SLEEP_5S, ADC_OFF, BOD_OFF ); etc

And wake it up using the interrupt from the rtc. However, as I said, I was only able to saw codes that are waking up boards from sleep mode in a fixed-time basis. How can I implement that when I have different delay arguments or durations?

The 8s (max) wake-up interval is based on using the WDT to generate the interrupt which awakens it. You can invoke sleep without WDT and use any asynchronous interrupt (pin change) to awaken.