Current time in widget

How to get current time in a widget (like the builtin clock widget), to update the widget based on the current time, since a widget is supposed to provide timely info?

Current time in widget
 
 
Q