reference-implementation/include/smalltime/nanotime.h
/**
 * Create a new time value, encoding the fields into a 64-bit unsigned integer.
 * Note: This function does NOT validate input! Make sure your source values are correct!
 *
 * @param year The year (1970 - 2226).
 * @param month The month of the year (1 - 12).
 * @param day The day of the month (1 - 31).
 * @param hour The hour of the day (0 - 23).
 * @param minute The minute of the hour (0 - 59).
 * @param second The second of the minute, allowing for leap second (0 - 60).
 * @param nanosecond The nanosecond of the second (0 - 999999999).
 * @return A new time value.
 */
Create a new time value, encoding the fields into a 64-bit unsigned integer.
Note: This function does NOT validate input. Make sure your source values are correct!


Create a new time value encoding the fields into a 64 - bit unsigned integer . Note : This function does NOT validate input . Make sure your source values are correct!
static inline nanotime nanotime_new(int year, int month, int day, int hour, int minute, int second, int nanosecond)
{
    return ((nanotime)(year-NANOTIME_ZERO_YEAR)   << NANOTIME_BITSHIFT_YEAR)   |
           ((nanotime)month  << NANOTIME_BITSHIFT_MONTH)  |
           ((nanotime)day    << NANOTIME_BITSHIFT_DAY)    |
           ((nanotime)hour   << NANOTIME_BITSHIFT_HOUR)   |
           ((nanotime)minute << NANOTIME_BITSHIFT_MINUTE) |
           ((nanotime)second << NANOTIME_BITSHIFT_SECOND) |
           nanosecond;
}
static inline nanotime nanotime_new ( int year , int month , int day , int hour , int minute , int second , int nanosecond ) { return ( ( nanotime ) ( year - NANOTIME_ZERO_YEAR ) << NANOTIME_BITSHIFT_YEAR ) | ( ( nanotime ) month << NANOTIME_BITSHIFT_MONTH ) | ( ( nanotime ) day << NANOTIME_BITSHIFT_DAY ) | ( ( nanotime ) hour << NANOTIME_BITSHIFT_HOUR ) | ( ( nanotime ) minute << NANOTIME_BITSHIFT_MINUTE ) | ( ( nanotime ) second << NANOTIME_BITSHIFT_SECOND ) | nanosecond ; }
Create a new time value, encoding the fields into a 64-bit unsigned integer.
Create a new time value encoding the fields into a 64 - bit unsigned integer .