Re: [PATCH] hwclock: --predict-hc for predicting RTC reading at a given time.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Mar 13, 2010 at 12:28:50PM +0200, Timo Juhani Lindfors wrote:
> Implement new option --predict-hc that predicts what the RTC will read
> at a time given by the --date option. This is useful for example if
> you need to setup an RTC wakeup time to distant future and want to
> account for the RTC drift.

Interesting idea :-)

Applied with a small change, I have renamed --predict-hc to --predict
(because we have --set, --show, etc. commands).

> +        } else if (predict_hc) {
> +            int adjustment;
> +            double retro;
> +
> +            calculate_adjustment(adjtime.drift_factor,
> +                                 adjtime.last_adj_time,
> +                                 adjtime.not_adjusted,
> +                                 set_time,
> +                                 &adjustment, &retro);
> +            if (debug) {
> +                printf(_("At %ld seconds after 1969, RTC is predicted to read %ld seconds after 1969.\n"),
> +                       set_time, set_time + adjustment);
> +            }
> +            display_time(TRUE, set_time + adjustment, -retro);
>          }

I see a small nit here. You can specify --date from past:

   # hwclock --predict --date "1/1/2000 16:00:00"
   Sat 01 Jan 2000 03:59:49 PM CET  0.376034 seconds

not sure what this prediction means :-) Maybe we need to check that set_time 
value is greater than gettimeofday().

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux