diff options
author | Jason St. John <jstjohn@purdue.edu> | 2014-03-18 00:27:05 -0400 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-03-24 20:49:34 +0100 |
commit | 07a062a79374406e8f6b5a1e2f80c80baf031567 (patch) | |
tree | 6162a7108289884bb34bb55d699266db13e1b274 /src | |
parent | 3caf0bc89ba1282db0f24fb1d179e67dc92a37e3 (diff) |
timedate: fix numerous grammar errors in comments and output/debug messages
Diffstat (limited to 'src')
-rw-r--r-- | src/timedate/timedate-sntp.c | 28 | ||||
-rw-r--r-- | src/timedate/timedatectl.c | 25 | ||||
-rw-r--r-- | src/timedate/timedated.c | 25 |
3 files changed, 38 insertions, 40 deletions
diff --git a/src/timedate/timedate-sntp.c b/src/timedate/timedate-sntp.c index 880b467a8e..e47a086567 100644 --- a/src/timedate/timedate-sntp.c +++ b/src/timedate/timedate-sntp.c @@ -205,7 +205,7 @@ static int sntp_send_request(SNTPContext *sntp) { * matching answer to our request. * * The actual value does not matter, We do not care about the correct - * NTP UINT_MAX fraction, we just pass the plain nanosecond value. + * NTP UINT_MAX fraction; we just pass the plain nanosecond value. */ clock_gettime(CLOCK_MONOTONIC, &sntp->trans_time_mon); clock_gettime(CLOCK_REALTIME, &sntp->trans_time); @@ -293,7 +293,7 @@ static int sntp_clock_watch(sd_event_source *source, int fd, uint32_t revents, v } /* resync */ - log_info("System time changed, resyncing."); + log_info("System time changed. Resyncing."); sntp->poll_resync = true; sntp_send_request(sntp); @@ -499,24 +499,24 @@ static int sntp_receive_response(sd_event_source *source, int fd, uint32_t reven int r; if (revents & (EPOLLHUP|EPOLLERR)) { - log_debug("Server connection returned error, closing."); + log_debug("Server connection returned error. Closing."); sntp_server_disconnect(sntp); return -ENOTCONN; } len = recvmsg(fd, &msghdr, MSG_DONTWAIT); if (len < 0) { - log_debug("Error receiving message, disconnecting"); + log_debug("Error receiving message. Disconnecting."); return -EINVAL; } if (iov.iov_len < sizeof(struct ntp_msg)) { - log_debug("Invalid response from server, disconnecting"); + log_debug("Invalid response from server. Disconnecting."); return -EINVAL; } if (sntp->server_addr.sin_addr.s_addr != server_addr.sin_addr.s_addr) { - log_debug("Response from unknown server, disconnecting"); + log_debug("Response from unknown server. Disconnecting."); return -EINVAL; } @@ -532,35 +532,35 @@ static int sntp_receive_response(sd_event_source *source, int fd, uint32_t reven } } if (!recv_time) { - log_debug("Invalid packet timestamp, disconnecting"); + log_debug("Invalid packet timestamp. Disconnecting."); return -EINVAL; } ntpmsg = iov.iov_base; if (!sntp->pending) { - log_debug("Unexpected reply, ignoring"); + log_debug("Unexpected reply. Ignoring."); return 0; } /* check our "time cookie" (we just stored nanoseconds in the fraction field) */ - if (be32toh(ntpmsg->origin_time.sec) != sntp->trans_time.tv_sec + OFFSET_1900_1970|| + if (be32toh(ntpmsg->origin_time.sec) != sntp->trans_time.tv_sec + OFFSET_1900_1970 || be32toh(ntpmsg->origin_time.frac) != sntp->trans_time.tv_nsec) { - log_debug("Invalid reply, not our transmit time, ignoring"); + log_debug("Invalid reply; not our transmit time. Ignoring."); return 0; } if (NTP_FIELD_LEAP(ntpmsg->field) == NTP_LEAP_NOTINSYNC) { - log_debug("Server is not synchronized, disconnecting"); + log_debug("Server is not synchronized. Disconnecting."); return -EINVAL; } if (NTP_FIELD_VERSION(ntpmsg->field) != 4) { - log_debug("Response NTPv%d, disconnecting", NTP_FIELD_VERSION(ntpmsg->field)); + log_debug("Response NTPv%d. Disconnecting.", NTP_FIELD_VERSION(ntpmsg->field)); return -EINVAL; } if (NTP_FIELD_MODE(ntpmsg->field) != NTP_MODE_SERVER) { - log_debug("Unsupported mode %d, disconnecting", NTP_FIELD_MODE(ntpmsg->field)); + log_debug("Unsupported mode %d. Disconnecting.", NTP_FIELD_MODE(ntpmsg->field)); return -EINVAL; } @@ -584,7 +584,7 @@ static int sntp_receive_response(sd_event_source *source, int fd, uint32_t reven * Transmit Timestamp T3 time reply sent by server * Destination Timestamp T4 time reply received by client * - * The roundtrip delay d and system clock offset t are defined as: + * The round-trip delay, d, and system clock offset, t, are defined as: * d = (T4 - T1) - (T3 - T2) t = ((T2 - T1) + (T3 - T4)) / 2" */ clock_gettime(CLOCK_MONOTONIC, &now_ts); diff --git a/src/timedate/timedatectl.c b/src/timedate/timedatectl.c index 089a5fe3ef..0664f6975d 100644 --- a/src/timedate/timedatectl.c +++ b/src/timedate/timedatectl.c @@ -109,7 +109,7 @@ static void print_status_info(const StatusInfo *i) { /* Enforce the values of /etc/localtime */ if (getenv("TZ")) { - fprintf(stderr, "Warning: ignoring the TZ variable, reading the system's timezone setting only.\n\n"); + fprintf(stderr, "Warning: Ignoring the TZ variable. Reading the system's time zone setting only.\n\n"); unsetenv("TZ"); } @@ -120,7 +120,7 @@ static void print_status_info(const StatusInfo *i) { sec = time(NULL); have_time = true; } else - fprintf(stderr, "Warning: could not get time from timedated and not operating locally.\n\n"); + fprintf(stderr, "Warning: Could not get time from timedated and not operating locally.\n\n"); if (have_time) { zero(tm); @@ -151,7 +151,7 @@ static void print_status_info(const StatusInfo *i) { zero(tm); assert_se(strftime(a, sizeof(a), "%Z, %z", localtime_r(&sec, &tm)) > 0); char_array_0(a); - printf(" Timezone: %s (%s)\n" + printf(" Time zone: %s (%s)\n" " NTP enabled: %s\n" "NTP synchronized: %s\n" " RTC in local TZ: %s\n", @@ -198,10 +198,10 @@ static void print_status_info(const StatusInfo *i) { if (i->rtc_local) fputs("\n" ANSI_HIGHLIGHT_ON - "Warning: The RTC is configured to maintain time in the local timezone. This\n" + "Warning: The RTC is configured to maintain time in the local time zone. This\n" " mode is not fully supported and will create various problems with time\n" - " zone changes and daylight saving adjustments. If at all possible use\n" - " RTC in UTC, by calling 'timedatectl set-local-rtc 0'" ANSI_HIGHLIGHT_OFF ".\n", stdout); + " zone changes and daylight saving time adjustments. If at all possible, use\n" + " RTC in UTC by calling 'timedatectl set-local-rtc 0'" ANSI_HIGHLIGHT_OFF ".\n", stdout); } static int show_status(sd_bus *bus, char **args, unsigned n) { @@ -286,7 +286,7 @@ static int set_timezone(sd_bus *bus, char **args, unsigned n) { NULL, "sb", args[1], arg_ask_password); if (r < 0) - log_error("Failed to set timezone: %s", bus_error_message(&error, -r)); + log_error("Failed to set time zone: %s", bus_error_message(&error, -r)); return r; } @@ -359,7 +359,7 @@ static int list_timezones(sd_bus *bus, char **args, unsigned n) { f = fopen("/usr/share/zoneinfo/zone.tab", "re"); if (!f) { - log_error("Failed to open timezone database: %m"); + log_error("Failed to open time zone database: %m"); return -errno; } @@ -371,7 +371,7 @@ static int list_timezones(sd_bus *bus, char **args, unsigned n) { if (feof(f)) break; - log_error("Failed to read timezone database: %m"); + log_error("Failed to read time zone database: %m"); return -errno; } @@ -380,7 +380,6 @@ static int list_timezones(sd_bus *bus, char **args, unsigned n) { if (isempty(p) || *p == '#') continue; - /* Skip over country code */ p += strcspn(p, WHITESPACE); p += strspn(p, WHITESPACE); @@ -423,7 +422,7 @@ static int help(void) { printf("%s [OPTIONS...] COMMAND ...\n\n" "Query or change system time and date settings.\n\n" - " -h --help Show this help\n" + " -h --help Show this help message\n" " --version Show package version\n" " --no-pager Do not pipe output into a pager\n" " --no-ask-password Do not prompt for password\n" @@ -433,8 +432,8 @@ static int help(void) { "Commands:\n" " status Show current time settings\n" " set-time TIME Set system time\n" - " set-timezone ZONE Set system timezone\n" - " list-timezones Show known timezones\n" + " set-timezone ZONE Set system time zone\n" + " list-timezones Show known time zones\n" " set-local-rtc BOOL Control whether RTC is in local time\n" " set-ntp BOOL Control whether NTP is enabled\n", program_invocation_short_name); diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c index c4a797acc9..3895e321c2 100644 --- a/src/timedate/timedated.c +++ b/src/timedate/timedated.c @@ -126,7 +126,7 @@ static int context_read_data(Context *c) { r = readlink_malloc("/etc/localtime", &t); if (r < 0) { if (r == -EINVAL) - log_warning("/etc/localtime should be a symbolic link to a timezone data file in /usr/share/zoneinfo/."); + log_warning("/etc/localtime should be a symbolic link to a time zone data file in /usr/share/zoneinfo/."); else log_warning("Failed to get target of /etc/localtime: %s", strerror(-r)); } else { @@ -137,7 +137,7 @@ static int context_read_data(Context *c) { e = path_startswith(t, "../usr/share/zoneinfo/"); if (!e) - log_warning("/etc/localtime should be a symbolic link to a timezone data file in /usr/share/zoneinfo/."); + log_warning("/etc/localtime should be a symbolic link to a time zone data file in /usr/share/zoneinfo/."); else { c->zone = strdup(e); if (!c->zone) @@ -263,9 +263,8 @@ static char** get_ntp_services(void) { char line[PATH_MAX], *l; if (!fgets(line, sizeof(line), f)) { - if (ferror(f)) - log_error("Failed to read NTP units file: %m"); + log_error("Failed to read NTP unit file: %m"); break; } @@ -313,7 +312,7 @@ static int context_read_ntp(Context *c, sd_bus *bus) { *i); if (r < 0) { - /* This implementation does not exist, try next one */ + /* This implementation does not exist. Try the next one. */ if (sd_bus_error_has_name(&error, SD_BUS_ERROR_FILE_NOT_FOUND)) continue; @@ -376,7 +375,7 @@ static int context_start_ntp(Context *c, sd_bus *bus, sd_bus_error *error) { if (sd_bus_error_has_name(error, SD_BUS_ERROR_FILE_NOT_FOUND) || sd_bus_error_has_name(error, "org.freedesktop.systemd1.LoadFailed") || sd_bus_error_has_name(error, "org.freedesktop.systemd1.NoSuchUnit")) { - /* This implementation does not exist, try next one */ + /* This implementation does not exist. Try the next one. */ sd_bus_error_free(error); continue; } @@ -425,7 +424,7 @@ static int context_enable_ntp(Context*c, sd_bus *bus, sd_bus_error *error) { if (r < 0) { if (sd_bus_error_has_name(error, SD_BUS_ERROR_FILE_NOT_FOUND)) { - /* This implementation does not exist, try next one */ + /* This implementation does not exist. Try the next one. */ sd_bus_error_free(error); continue; } @@ -468,10 +467,10 @@ static int property_get_rtc_time( zero(tm); r = hwclock_get_time(&tm); if (r == -EBUSY) { - log_warning("/dev/rtc is busy, is somebody keeping it open continuously? That's not a good idea... Returning a bogus RTC timestamp."); + log_warning("/dev/rtc is busy. Is somebody keeping it open continuously? That's not a good idea... Returning a bogus RTC timestamp."); t = 0; } else if (r == -ENOENT) { - log_debug("Not /dev/rtc found."); + log_debug("/dev/rtc not found."); t = 0; /* no RTC found */ } else if (r < 0) return sd_bus_error_set_errnof(error, r, "Failed to read RTC: %s", strerror(-r)); @@ -542,8 +541,8 @@ static int method_set_timezone(sd_bus *bus, sd_bus_message *m, void *userdata, s /* 1. Write new configuration file */ r = context_write_data_timezone(c); if (r < 0) { - log_error("Failed to set timezone: %s", strerror(-r)); - return sd_bus_error_set_errnof(error, r, "Failed to set timezone: %s", strerror(-r)); + log_error("Failed to set time zone: %s", strerror(-r)); + return sd_bus_error_set_errnof(error, r, "Failed to set time zone: %s", strerror(-r)); } /* 2. Tell the kernel our timezone */ @@ -562,7 +561,7 @@ static int method_set_timezone(sd_bus *bus, sd_bus_message *m, void *userdata, s log_struct(LOG_INFO, MESSAGE_ID(SD_MESSAGE_TIMEZONE_CHANGE), "TIMEZONE=%s", c->zone, - "MESSAGE=Changed timezone to '%s'.", c->zone, + "MESSAGE=Changed time zone to '%s'.", c->zone, NULL); sd_bus_emit_properties_changed(bus, "/org/freedesktop/timedate1", "org.freedesktop.timedate1", "Timezone", NULL); @@ -847,7 +846,7 @@ int main(int argc, char *argv[]) { r = context_read_data(&context); if (r < 0) { - log_error("Failed to read timezone data: %s", strerror(-r)); + log_error("Failed to read time zone data: %s", strerror(-r)); goto finish; } |