how to compare time using ds3231

I have set alarm 1 and 2 with different time on my ds3231 and I want to see which alarm will trigger first. how can I compare the time in HH:MM format? as far as I know its a structure and I dont know if it can be compared as one single entity. is there any function to do it?

I dont want to compare hour and minute separately.

You haven’t included your code nor any indication of the library(s) used, so how can we say?

Use a library with a method that will convert a DD:MM:YY:HH:MM:SS time structure into 32-bit “Unix Time”. Compare the two times in that format.

Well I dont have any code yet. I am just thinking of adding it to my upcoming project.

I will be using this library - GitHub - sleemanj/DS3231_Simple: An Arduino Library for EASY communication with DS3231 I2C RTC Clo

I have never done unixtime before and more info on how it is used will be great. any existing library?

https://www.pjrc.com/teensy/td_libs_Time.html

I found the solution on this forum - arduino uno - The difference between "time_t" and "DateTime" - Arduino Stack Exchange

here is the quate from that forum -

A DateTime is a full class with lots of methods to it - a time_t is just an unsigned long.
time_t is used to store the number of seconds since the epoch (normally 01/01/1970)
The Arduino Time library returns a time_t to the now() function - but RTCLib return s a DateTime object.
The DateTime object, though, has a unixtime() method which will return a time_t representation of the time stored in the DateTime object.
So you can do:

DateTime dt = RTC.now();
time_t time = dt.unixtime();

The library that you linked in Reply #3 does not have that functionality.

gfvalvo:
The library that you linked in Reply #3 does not have that functionality.

I have not tested it yet but I can change the library if required. the good thing is that the function for unixtime is available.

bkrenderman:
the good thing is that the function for unixtime is available.

Of course it is, that’s why I told you to use it back in Reply #2.

gfvalvo:
Of course it is, that’s why I told you to use it back in Reply #2.

Thanks!