from my own Time In Daylight data, i can say that it uses a hybrid formula to calculate this.
it uses either/or/both of these two data points:
1 it measures the actual time "light" that is strong enough for it to register as "daylight" actually hits it's light sensor.
normal indoor light would not be strong enough to register as day light it appears. but if you work with very strongly lit conditions and your watch is directly exposed to that, then it will probably register it as day light. but not regular indoor lighting.
2 if you record an Activity such as Outdoor Walk during your day time, then it will just simply use ("believe") that info as done outside, in "daylight".
a good example of this is:
yesterday, i used Activity app to record an actual outdoor walk. the walk was 91 minutes. however, its cold winter here. during that walk, i had thick gloves and two layers of jackets and a shirt. no way the watch sensor was able to actually use its light monitor to register it as "daylight". however, in the iPhone Health app it registered for yesterday a time in daylight as 127 minutes. this is probably close to "accurate", as my desk in my house is in front a huge picture window with bright light pouring in, and im sure my watch was exposed directly to that light for some of the time (not covered by my sleeve during time inside near that big window).so the total time of 127 seems accurate to me.
i have never gone back to see if it records an outdoor walk done at night correctly as time not in daylight. but i would imagine that it uses the time of day to factor it in.
what the apple methodology does not do however, is factor in weather conditions, and does not factor in latitude, nor does it factor in seasonal earth's point versus the sun (angle). it would need to use all 3 of these factors to be ale to help you get an estimate for how much Vitamin D your body is making. but, as they say, there is app for that
a few months ago i investigated all that because although it only takes a few minutes to walk outside in daylight for the body to make enough Vitamin D in most locations, in fact, at certain latitudes, in winter the suns' angle doesn't get above 60 degrees and for Vitamin D production the sun's angle relative to the earth needs to be min 60 degrees, so at some northern latitudes in winter you can spend 5 hours outside and never have any naturally made Vitamin D.
the thing is, Vitamin D every knows/thinks as good for bones. but D helps regulate the immune system as well. studies during the recent pandemic showed that persons with D deficiency suffered much worse with COVID.
apple could be / should be doing a lot more by connecting the data points it is already measuring. the watch has so much more potential for health and fitness.