summaryrefslogtreecommitdiff
path: root/src/utmp-wtmp.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-05-24 01:45:54 +0200
committerLennart Poettering <lennart@poettering.net>2010-05-24 01:45:54 +0200
commit871d7de47c13ee6cd78b8eefdf9128be3c740ac0 (patch)
treec92b146f086cdf7a58145e4e744133e645f8c8e0 /src/utmp-wtmp.c
parent4288f619215e3dda0b75113d78e4fb7ba219ed58 (diff)
timer: fully implement timer units
Diffstat (limited to 'src/utmp-wtmp.c')
-rw-r--r--src/utmp-wtmp.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/utmp-wtmp.c b/src/utmp-wtmp.c
index cb3f201322..ba0273f776 100644
--- a/src/utmp-wtmp.c
+++ b/src/utmp-wtmp.c
@@ -89,7 +89,7 @@ int utmp_get_runlevel(int *runlevel, int *previous) {
return r;
}
-static void init_entry(struct utmpx *store, usec_t timestamp) {
+static void init_entry(struct utmpx *store, usec_t t) {
struct utsname uts;
assert(store);
@@ -97,11 +97,11 @@ static void init_entry(struct utmpx *store, usec_t timestamp) {
zero(*store);
zero(uts);
- if (timestamp <= 0)
- timestamp = now(CLOCK_REALTIME);
+ if (t <= 0)
+ t = now(CLOCK_REALTIME);
- store->ut_tv.tv_sec = timestamp / USEC_PER_SEC;
- store->ut_tv.tv_usec = timestamp % USEC_PER_SEC;
+ store->ut_tv.tv_sec = t / USEC_PER_SEC;
+ store->ut_tv.tv_usec = t % USEC_PER_SEC;
if (uname(&uts) >= 0)
strncpy(store->ut_host, uts.release, sizeof(store->ut_host));
@@ -162,10 +162,10 @@ static int write_entry_both(const struct utmpx *store) {
return r;
}
-int utmp_put_shutdown(usec_t timestamp) {
+int utmp_put_shutdown(usec_t t) {
struct utmpx store;
- init_entry(&store, timestamp);
+ init_entry(&store, t);
store.ut_type = RUN_LVL;
strncpy(store.ut_user, "shutdown", sizeof(store.ut_user));
@@ -173,10 +173,10 @@ int utmp_put_shutdown(usec_t timestamp) {
return write_entry_both(&store);
}
-int utmp_put_reboot(usec_t timestamp) {
+int utmp_put_reboot(usec_t t) {
struct utmpx store;
- init_entry(&store, timestamp);
+ init_entry(&store, t);
store.ut_type = BOOT_TIME;
strncpy(store.ut_user, "reboot", sizeof(store.ut_user));
@@ -184,7 +184,7 @@ int utmp_put_reboot(usec_t timestamp) {
return write_entry_both(&store);
}
-int utmp_put_runlevel(usec_t timestamp, int runlevel, int previous) {
+int utmp_put_runlevel(usec_t t, int runlevel, int previous) {
struct utmpx store;
int r;
@@ -204,7 +204,7 @@ int utmp_put_runlevel(usec_t timestamp, int runlevel, int previous) {
return 0;
}
- init_entry(&store, timestamp);
+ init_entry(&store, t);
store.ut_type = RUN_LVL;
store.ut_pid = (runlevel & 0xFF) | ((previous & 0xFF) << 8);