def get_gps_time(tnow):
    """return gps_week and gps_week_ms for current time"""
    leapseconds = 18
    SEC_PER_WEEK = 7 * 86400
    epoch = 86400 * (10 * 365 + (1980 - 1969) / 4 + 1 + 6 - 2) - leapseconds
    epoch_seconds = int(tnow - epoch)
    week = int(epoch_seconds) // SEC_PER_WEEK
    t_ms = int(tnow * 1000) % 1000
    week_ms = epoch_seconds % SEC_PER_WEEK * 1000 + t_ms // 200 * 200
    return week, week_ms
