/* returns system time in milisecond unit. 
This function returns system time. The unit is 1/1024 of second due to fact that RTC is used for counting time.  */
int GUI_X_GetTime(void)
/* returns system time in milisecond unit. 
This function returns system time. The unit is 1/1024 of second due to fact that RTC is used for counting time.  */
int GUI_X_GetTime(void)
{ int timeNow = RTC_CounterGet()>>RTC_MS_SHIFT;
  if( (timeNow  ^ time) & (RTC_HIGHEST_BIT>>RTC_MS_SHIFT) )
  {
    time |= _RTC_COMP0_COMP0_MASK >> RTC_MS_SHIFT;
    time ++;
    time |= timeNow;
  } else
  {
    time &= ~(_RTC_COMP0_COMP0_MASK >> RTC_MS_SHIFT);
    time |= timeNow;
  }
  return time;
}