aboutsummaryrefslogtreecommitdiffstats
path: root/fs/pstore/ram.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/pstore/ram.c')
-rw-r--r--fs/pstore/ram.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index 1a4f6da58eab..dacfe78aee7e 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -168,12 +168,16 @@ static ssize_t ramoops_pstore_read(u64 *id, enum pstore_type_id *type,
168static size_t ramoops_write_kmsg_hdr(struct persistent_ram_zone *prz) 168static size_t ramoops_write_kmsg_hdr(struct persistent_ram_zone *prz)
169{ 169{
170 char *hdr; 170 char *hdr;
171 struct timeval timestamp; 171 struct timespec timestamp;
172 size_t len; 172 size_t len;
173 173
174 do_gettimeofday(&timestamp); 174 /* Report zeroed timestamp if called before timekeeping has resumed. */
175 if (__getnstimeofday(&timestamp)) {
176 timestamp.tv_sec = 0;
177 timestamp.tv_nsec = 0;
178 }
175 hdr = kasprintf(GFP_ATOMIC, RAMOOPS_KERNMSG_HDR "%lu.%lu\n", 179 hdr = kasprintf(GFP_ATOMIC, RAMOOPS_KERNMSG_HDR "%lu.%lu\n",
176 (long)timestamp.tv_sec, (long)timestamp.tv_usec); 180 (long)timestamp.tv_sec, (long)(timestamp.tv_nsec / 1000));
177 WARN_ON_ONCE(!hdr); 181 WARN_ON_ONCE(!hdr);
178 len = hdr ? strlen(hdr) : 0; 182 len = hdr ? strlen(hdr) : 0;
179 persistent_ram_write(prz, hdr, len); 183 persistent_ram_write(prz, hdr, len);