diff options
Diffstat (limited to 'hcid/storage.c')
-rw-r--r-- | hcid/storage.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/hcid/storage.c b/hcid/storage.c index 063b6952..a553ae96 100644 --- a/hcid/storage.c +++ b/hcid/storage.c @@ -137,6 +137,22 @@ int write_lastseen_info(bdaddr_t *local, bdaddr_t *peer, struct tm *tm) return textfile_put(filename, addr, str); } +int write_lastused_info(bdaddr_t *local, bdaddr_t *peer, struct tm *tm) +{ + char filename[PATH_MAX + 1], addr[18], str[24]; + + memset(str, 0, sizeof(str)); + strftime(str, sizeof(str), "%Y-%m-%d %H:%M:%S %Z", tm); + + ba2str(local, addr); + snprintf(filename, PATH_MAX, "%s/%s/lastused", STORAGEDIR, addr); + + create_file(filename, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); + + ba2str(peer, addr); + return textfile_put(filename, addr, str); +} + int write_link_key(bdaddr_t *local, bdaddr_t *peer, unsigned char *key, int type) { char filename[PATH_MAX + 1], addr[18], str[35]; |