|NetworkManager applet (Photo credit: Wikipedia)|
NetworkManager offers this feature through a mechanism called a dispatcher. Basically, the dispatcher looks into the /etc/NetworkManager/dispatcher.d directory and run scripts saved in there. Scripts start with a two digit number that determines the order they are run. The scripts are passed two parameters from the main NetworkManager system. They are the network interface that was connected or disconnected and whether it was connected or disconnected.
In my case, I didn't care which network interface it was but it had to be just connected. So the script looked something like this.
# Run ntpdate when network interface goes up using NetworkManager
if [ "$2" = "up" ]; then
/usr/sbin/ntpdate -u pool.ntp.org
logger Updated time due to network interface going up
Save the file as 10-ntpdate.sh and change it's attributes to be executable. Drop that into the /etc/NetworkManater/dispatcher.d directory. That's it.