1*acfd1684Schristos /* $NetBSD: clock_subr.h,v 1.3 2014/12/22 18:08:39 christos Exp $ */ 2d67a8a7dSmartin 3d67a8a7dSmartin /*- 4d67a8a7dSmartin * Copyright (c) 1996 The NetBSD Foundation, Inc. 5d67a8a7dSmartin * All rights reserved. 6d67a8a7dSmartin * 7d67a8a7dSmartin * This code is derived from software contributed to The NetBSD Foundation 8d67a8a7dSmartin * by Gordon W. Ross 9d67a8a7dSmartin * 10d67a8a7dSmartin * Redistribution and use in source and binary forms, with or without 11d67a8a7dSmartin * modification, are permitted provided that the following conditions 12d67a8a7dSmartin * are met: 13d67a8a7dSmartin * 1. Redistributions of source code must retain the above copyright 14d67a8a7dSmartin * notice, this list of conditions and the following disclaimer. 15d67a8a7dSmartin * 2. Redistributions in binary form must reproduce the above copyright 16d67a8a7dSmartin * notice, this list of conditions and the following disclaimer in the 17d67a8a7dSmartin * documentation and/or other materials provided with the distribution. 18d67a8a7dSmartin * 19d67a8a7dSmartin * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20d67a8a7dSmartin * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21d67a8a7dSmartin * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22d67a8a7dSmartin * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23d67a8a7dSmartin * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24d67a8a7dSmartin * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25d67a8a7dSmartin * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26d67a8a7dSmartin * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27d67a8a7dSmartin * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28d67a8a7dSmartin * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29d67a8a7dSmartin * POSSIBILITY OF SUCH DAMAGE. 30d67a8a7dSmartin */ 31d67a8a7dSmartin 32d67a8a7dSmartin #ifndef _DEV_CLOCK_SUBR_H_ 33d67a8a7dSmartin #define _DEV_CLOCK_SUBR_H_ 34d67a8a7dSmartin 35d67a8a7dSmartin /* 36d67a8a7dSmartin * This is a slightly stripped down version of src/sys/dev/clock_subr.h 37d67a8a7dSmartin */ 38d67a8a7dSmartin 39d67a8a7dSmartin /* 40d67a8a7dSmartin * "POSIX time" to/from "YY/MM/DD/hh/mm/ss" 41d67a8a7dSmartin */ 42d67a8a7dSmartin struct clock_ymdhms { 435621a8b9Smartin uint64_t dt_year; 44d67a8a7dSmartin u_char dt_mon; 45d67a8a7dSmartin u_char dt_day; 46d67a8a7dSmartin u_char dt_wday; /* Day of week */ 47d67a8a7dSmartin u_char dt_hour; 48d67a8a7dSmartin u_char dt_min; 49d67a8a7dSmartin u_char dt_sec; 50d67a8a7dSmartin }; 51d67a8a7dSmartin 52d67a8a7dSmartin time_t clock_ymdhms_to_secs(struct clock_ymdhms *); 535621a8b9Smartin int clock_secs_to_ymdhms(time_t, struct clock_ymdhms *); 54d67a8a7dSmartin 55d67a8a7dSmartin #endif /* _DEV_CLOCK_SUBR_H_ */ 56