Many embedded ports, including MicroPython, use Epoch time of January 1, 2000. This is 946,684,800 seconds later than UNIX Epoch time of January 1, 1970. If you first set your RTC using NTP, you will be able to read MicroPython's Epoch in seconds. It sounds like your're on a network so it should be easy to do. Assuming you're already connected to WiFi, here's how to set the RTC time:
import ntptime
# General call to set RTC shown
# Note that when setting datetime, Weekday is ignored. MicroPython uses its internal calendar.
# machine.RTC().datetime((yyyy, mm, dd, Weekday, hh, mm, ss, us))
# RTC code follows.
ntptime.settime() # This library call sets RTC to ntp time.
machine.RTC().datetime() # Read the hardware RTC in datetime format.
After you've given your ESP32 GMT NTP time, you can read the number of seconds from MycroPython Epoch with:
import utime
utime.time()
My result was this number, 634791870. It is integer seconds. With MicroPython there is no precision beyond seconds with this call. (You can get microseconds using datetime(), but that's in datetime not timestamp format.)
Next you have to do a little arithmetic:
timestamp = 946684800 + utime.time()
This gives you a UTC timestamp from Unix Epoch in integer seconds. (MicroPython ignores timezone.) To adjust for local time you need to add 3600 for each hour going east from 0 deg longitude and subtract it going west.
If your application needs a floating point format, you can just add a 0.0.