reference-implementation/include/smalltime/nanotime.h
/**
 * Get a new time based on an existing one, with a new year component.
 * Valid range is 1970 - 2226.
 * Note: Input is NOT validated!
 *
 * @param time The existing time value.
 * @param year The year component.
 * @return the new time value.
 */
Get a new time based on an existing one, with a new year component.

@param time The existing time value.
@param year The year component.
@return the new time value.
Get a new time based on an existing one with a new year component . @param time The existing time value . @param year The year component . @return the new time value .
static inline nanotime nanotime_with_year(nanotime time, int year)
{
    return (time & ~NANOTIME_MASK_YEAR) |
        ((nanotime)(year-NANOTIME_ZERO_YEAR) << NANOTIME_BITSHIFT_YEAR);
}
static inline nanotime nanotime_with_year ( nanotime time , int year ) { return ( time & ~ NANOTIME_MASK_YEAR ) | ( ( nanotime ) ( year - NANOTIME_ZERO_YEAR ) << NANOTIME_BITSHIFT_YEAR ) ; }
Get a new time based on an existing one, with a new year component.
Get a new time based on an existing one with a new year component .