Its Clever thats for sure... I had the same question when I tried to cheat the game.
The cartrage cannot possibly have an internal clock, when running on an emulator or R4 ect, where would the clock be then?
I think its a lot simpler than that, I think that the DS reports time changes to the game. The cartrage then slaps down the user for trying to cheat.
In the case of honey trees, there is a timer value that counts down every minute, when in a certain range the tree appears active. When you save the game this value is saved, as well as the current time.
When the game is loaded the game probably asks the DS if the time has changed since loading:
if it hasn`t then it updates the minutes counter accordingly.
if it has then it doesn`t update, or resets the timer ect...
You can use this to your advantage, If you forget to check your honey trees and the pokemon is gone, change your date and the timer will be reset giving you another chance.
btw... If you can make hex changes to the save file its easy to cheat the timer and also change the pokemon to the one you want. You can`t determine sex or stats ect though.