Use standby state \fImode\fP. Valid values are \fIstandby\fP,
\fImem\fP, \fIdisk\fP and \fIon\fP (no suspend). The default is
\fIstandby\fP.
+.SH NOTES
+Some PC systems can't currently exit sleep states such as \fImem\fP
+using only the kernel code accessed by this driver.
+They need help from userspace code to make the framebuffer work again.
.SH HISTORY
-The program first appeared as kernel commit message for Linux 2.6 in the GIT
+The program was posted several times on LKML and other lists
+before appearing in kernel commit message for Linux 2.6 in the GIT
commit 87ac84f42a7a580d0dd72ae31d6a5eb4bfe04c6d.
.SH AVAILABILITY
The rtcwake command is part of the util-linux-ng package and is available from
ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/.
.SH AUTHOR
-The program was written by David Brownell <david-b@pacbell.net> and improved by
-Bernhard Walle <bwalle@suse.de>.
+The program was written by David Brownell <dbrownell@users.sourceforge.net>
+and improved by Bernhard Walle <bwalle@suse.de>.
.SH COPYRIGHT
This is free software. You may redistribute copies of it under the terms
of the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
* The best way to set the system's RTC is so that it holds the current
* time in UTC. Use the "-l" flag to tell this program that the system
* RTC uses a local timezone instead (maybe you dual-boot MS-Windows).
+ * That flag should not be needed on systems with adjtime support.
*/
#include <stdio.h>
}
if (verbose) {
- if (clock_mode == CM_LOCAL) {
- printf("\ttzone = %ld\n", timezone);
- printf("\ttzname = %s\n", tzname[daylight]);
- gmtime_r(&rtc_time, &tm);
- }
- printf("\tsystime = %ld, (UTC) %s\n",
+ /* Unless the system uses UTC, either delta or tzone
+ * reflects a seconds offset from UTC. The value can
+ * help sort out problems like bugs in your C library.
+ */
+ printf("\tdelta = %ld\n", sys_time - rtc_time);
+ printf("\ttzone = %ld\n", timezone);
+
+ printf("\ttzname = %s\n", tzname[daylight]);
+ gmtime_r(&rtc_time, &tm);
+ printf("\tsystime = %ld, (UTC) %s",
(long) sys_time, asctime(gmtime(&sys_time)));
- printf("\trtctime = %ld, (UTC) %s\n",
+ printf("\trtctime = %ld, (UTC) %s",
(long) rtc_time, asctime(&tm));
}
wake.time.tm_mday = tm->tm_mday;
wake.time.tm_mon = tm->tm_mon;
wake.time.tm_year = tm->tm_year;
- wake.time.tm_wday = tm->tm_wday;
- wake.time.tm_yday = tm->tm_yday;
- wake.time.tm_isdst = tm->tm_isdst;
+ /* wday, yday, and isdst fields are unused by Linux */
+ wake.time.tm_wday = -1;
+ wake.time.tm_yday = -1;
+ wake.time.tm_isdst = -1;
- /* many rtc alarms only support up to 24 hours from 'now' ... */
+ /* many rtc alarms only support up to 24 hours from 'now',
+ * so use the "more than 24 hours" request only if we must
+ */
if ((rtc_time + (24 * 60 * 60)) > *wakeup) {
if (ioctl(fd, RTC_ALM_SET, &wake.time) < 0) {
perror(_("set rtc alarm"));
perror(_("enable rtc alarm"));
return 0;
}
-
- /* ... so use the "more than 24 hours" request only if we must */
} else {
/* avoid an extra AIE_ON call */
wake.enabled = 1;
suspend = strdup(optarg);
break;
}
- fprintf(stderr, _("%s: unrecognized suspend state '%s'\n"),
- progname, optarg);
+ fprintf(stderr,
+ _("%s: unrecognized suspend state '%s'\n"),
+ progname, optarg);
usage(EXIT_FAILURE);
/* alarm time, seconds-to-sleep (relative) */
printf(_("%s: assuming RTC uses UTC ...\n"), progname);
clock_mode = CM_UTC;
}
- if (verbose)
- printf(clock_mode == CM_UTC ? _("Using UTC time.\n") :
- _("Using local time.\n"));
}
+ if (verbose)
+ printf(clock_mode == CM_UTC ? _("Using UTC time.\n") :
+ _("Using local time.\n"));
if (!alarm && !seconds) {
fprintf(stderr, _("%s: must provide wake time\n"), progname);
alarm, sys_time, rtc_time, seconds);
if (alarm) {
if (alarm < sys_time) {
- fprintf(stderr, _("%s: time doesn't go backward to %s\n"),
- progname, ctime(&alarm));
+ fprintf(stderr,
+ _("%s: time doesn't go backward to %s\n"),
+ progname, ctime(&alarm));
exit(EXIT_FAILURE);
}
alarm += sys_time - rtc_time;