Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 751cabc in mainline


Ignore:
Timestamp:
2012-04-05T19:42:22Z (10 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master
Children:
85f2064
Parents:
f61a326
Message:

date: print a warning message if the cmos battery is dead

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/date/date.c

    rf61a326 r751cabc  
    3434#include <time.h>
    3535#include <malloc.h>
     36#include <ipc/clock_ctl.h>
    3637
    3738#define NAME   "date"
     
    4647        service_id_t svc_id;
    4748        char *svc_name = NULL;
     49
     50        sysarg_t battery_ok;
    4851        struct tm t;
    4952
     
    9396        }
    9497
     98        async_exch_t *exch = async_exchange_begin(sess);
     99        rc = async_req_0_1(exch, CLOCK_GET_BATTERY_STATUS, &battery_ok);
     100        async_exchange_end(exch);
     101
     102        if (rc == EOK && !battery_ok)
     103                printf(NAME ": Warning! RTC battery dead\n");
     104
    95105        /* Read the current date/time */
    96106        rc = clock_dev_time_get(sess, &t);
Note: See TracChangeset for help on using the changeset viewer.