[BACK]Return to time.c CVS log [TXT][DIR] Up to [local] / sys / arch / hppa64 / stand / libsa

Annotation of sys/arch/hppa64/stand/libsa/time.c, Revision 1.1.1.1

1.1       nbrk        1: /*     $OpenBSD: time.c,v 1.1 2005/04/01 10:40:48 mickey Exp $ */
                      2:
                      3: /*
                      4:  * Copyright (c) 2005 Michael Shalayeff
                      5:  * All rights reserved.
                      6:  *
                      7:  * Permission to use, copy, modify, and distribute this software for any
                      8:  * purpose with or without fee is hereby granted, provided that the above
                      9:  * copyright notice and this permission notice appear in all copies.
                     10:  *
                     11:  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
                     12:  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
                     13:  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
                     14:  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
                     15:  * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN
                     16:  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
                     17:  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
                     18:  */
                     19:
                     20: #include <sys/types.h>
                     21: #include <machine/pdc.h>
                     22: #include <sys/disklabel.h>
                     23: #include "libsa.h"
                     24: #include "dev_hppa64.h"
                     25:
                     26: time_t
                     27: getsecs()
                     28: {
                     29:        time_t tt;
                     30:        int err;
                     31:
                     32:        if ((err = (*pdc)(PDC_TOD, PDC_TOD_READ, &pdcbuf)) < 0) {
                     33:                tt = 0;
                     34: #ifdef DEBUG
                     35:                if (debug)
                     36:                        printf("getsecs: TOD read failed (%d)\n", err);
                     37: #endif
                     38:        } else {
                     39:                tt = ((struct pdc_tod *)pdcbuf)->sec;
                     40: #ifdef DEBUG
                     41:                if (debug && tt < 800000000)
                     42:                        printf("getsecs: got %u seconds\n", tt);
                     43: #endif
                     44:        }
                     45:
                     46:        return tt;
                     47: }

CVSweb