I don't think there is a technical difficulty in gathering such information. Lack of such apps is likely because of lack of demand. For an average user, it is not the time that is important but the data used while on a plan or roaming and hence an abundance of such apps
I am not aware if the information you seek can be pulled from Android OS requiring programming skill . There is an open source app Network Monitor, which can help you. It doesn't directly give you what you want, but information can easily be extracted. App has been updated last month. Extract from app description:
Network Monitor is a diagnostic tool which periodically tests your network connection and logs the results to a database on the phone....It also logs other information about your device and connection status, such as:
The network type (WiFi, mobile/EDGE, mobile/HSPA, etc)
It offers a rich selection of features to log and display. This solution shows minimum settings required to achieve your goal :
Network Settings → Enable Service ( Enable / disable as required per duration of monitoring)
Network Settings → Log frequency can be varied from 1/2 sec to 1 hour , depending on the accuracy you need
Advanced Options → Fields to monitor - offers 50 + fields. Basic fields needed would be :
Timestamp
Network Type
Is connected
You can view the log file with these settings as shown in the screenshot below
Log file can be exported ( mail it yourself) in several formats (Excel, CSV, HTML, KML, Gnuplot
the raw database) , for further analysis. Excel would be the obvious choice.
You can filter the Network Type and Is connected =1 ( to avoid disconnected times ), say for WiFi
Use the count
function of Excel and multiply it with log frequency ( i.e, time) to arrive at total time and convert it to hh:mm
format - my Excel is rusty, there should be better ways :)
Repeat for mobile data