GLib.DateTime is a valid way of doing this, and it's a bit weird that you're requesting a local time then converting it to unix time (which implicitly converts to UTC). The real problem, though, is that you're conflating milliseconds (1/1000th of a second) and microseconds (1/1000000th of a second). So change the last line to
var msec = (sec * 1000) + (now.get_microsecond () / 1000);
Alternatively, an easier way would be to use GLib.get_real_time:
int64 msec = GLib.get_real_time () / 1000;
Depending on your use case you might want to consider using monotonic time instead of real time (see GLib.get_monotonic_time