Class spng_time

All Implemented Interfaces:
AutoCloseable, NativeResource, Pointer

public class spng_time extends Struct<spng_time> implements NativeResource

 struct spng_time {
     uint16_t year;
     uint8_t month;
     uint8_t day;
     uint8_t hour;
     uint8_t minute;
     uint8_t second;
 }
  • Field Details

    • SIZEOF

      public static final int SIZEOF
      The struct size in bytes.
    • ALIGNOF

      public static final int ALIGNOF
      The struct alignment in bytes.
    • YEAR

      public static final int YEAR
      The struct member offsets.
    • MONTH

      public static final int MONTH
      The struct member offsets.
    • DAY

      public static final int DAY
      The struct member offsets.
    • HOUR

      public static final int HOUR
      The struct member offsets.
    • MINUTE

      public static final int MINUTE
      The struct member offsets.
    • SECOND

      public static final int SECOND
      The struct member offsets.
  • Constructor Details

    • spng_time

      public spng_time(ByteBuffer container)
      Creates a spng_time instance at the current position of the specified ByteBuffer container. Changes to the buffer's content will be visible to the struct instance and vice versa.

      The created instance holds a strong reference to the container object.

  • Method Details

    • sizeof

      public int sizeof()
      Description copied from class: Struct
      Returns sizeof(struct).
      Specified by:
      sizeof in class Struct<spng_time>
    • year

      public short year()
      Returns:
      the value of the year field.
    • month

      public byte month()
      Returns:
      the value of the month field.
    • day

      public byte day()
      Returns:
      the value of the day field.
    • hour

      public byte hour()
      Returns:
      the value of the hour field.
    • minute

      public byte minute()
      Returns:
      the value of the minute field.
    • second

      public byte second()
      Returns:
      the value of the second field.
    • year

      public spng_time year(short value)
      Sets the specified value to the year field.
    • month

      public spng_time month(byte value)
      Sets the specified value to the month field.
    • day

      public spng_time day(byte value)
      Sets the specified value to the day field.
    • hour

      public spng_time hour(byte value)
      Sets the specified value to the hour field.
    • minute

      public spng_time minute(byte value)
      Sets the specified value to the minute field.
    • second

      public spng_time second(byte value)
      Sets the specified value to the second field.
    • set

      public spng_time set(short year, byte month, byte day, byte hour, byte minute, byte second)
      Initializes this struct with the specified values.
    • set

      public spng_time set(spng_time src)
      Copies the specified struct data to this struct.
      Parameters:
      src - the source struct
      Returns:
      this struct
    • malloc

      public static spng_time malloc()
      Returns a new spng_time instance allocated with memAlloc. The instance must be explicitly freed.
    • calloc

      public static spng_time calloc()
      Returns a new spng_time instance allocated with memCalloc. The instance must be explicitly freed.
    • create

      public static spng_time create()
      Returns a new spng_time instance allocated with BufferUtils.
    • create

      public static spng_time create(long address)
      Returns a new spng_time instance for the specified memory address.
    • createSafe

      public static @Nullable spng_time createSafe(long address)
      Like create, but returns null if address is NULL.
    • malloc

      public static spng_time.Buffer malloc(int capacity)
      Returns a new spng_time.Buffer instance allocated with memAlloc. The instance must be explicitly freed.
      Parameters:
      capacity - the buffer capacity
    • calloc

      public static spng_time.Buffer calloc(int capacity)
      Returns a new spng_time.Buffer instance allocated with memCalloc. The instance must be explicitly freed.
      Parameters:
      capacity - the buffer capacity
    • create

      public static spng_time.Buffer create(int capacity)
      Returns a new spng_time.Buffer instance allocated with BufferUtils.
      Parameters:
      capacity - the buffer capacity
    • create

      public static spng_time.Buffer create(long address, int capacity)
      Create a spng_time.Buffer instance at the specified memory.
      Parameters:
      address - the memory address
      capacity - the buffer capacity
    • createSafe

      public static @Nullable spng_time.Buffer createSafe(long address, int capacity)
      Like create, but returns null if address is NULL.
    • malloc

      public static spng_time malloc(MemoryStack stack)
      Returns a new spng_time instance allocated on the specified MemoryStack.
      Parameters:
      stack - the stack from which to allocate
    • calloc

      public static spng_time calloc(MemoryStack stack)
      Returns a new spng_time instance allocated on the specified MemoryStack and initializes all its bits to zero.
      Parameters:
      stack - the stack from which to allocate
    • malloc

      public static spng_time.Buffer malloc(int capacity, MemoryStack stack)
      Returns a new spng_time.Buffer instance allocated on the specified MemoryStack.
      Parameters:
      capacity - the buffer capacity
      stack - the stack from which to allocate
    • calloc

      public static spng_time.Buffer calloc(int capacity, MemoryStack stack)
      Returns a new spng_time.Buffer instance allocated on the specified MemoryStack and initializes all its bits to zero.
      Parameters:
      capacity - the buffer capacity
      stack - the stack from which to allocate
    • nyear

      public static short nyear(long struct)
      Unsafe version of year().
    • nmonth

      public static byte nmonth(long struct)
      Unsafe version of month().
    • nday

      public static byte nday(long struct)
      Unsafe version of day().
    • nhour

      public static byte nhour(long struct)
      Unsafe version of hour().
    • nminute

      public static byte nminute(long struct)
      Unsafe version of minute().
    • nsecond

      public static byte nsecond(long struct)
      Unsafe version of second().
    • nyear

      public static void nyear(long struct, short value)
      Unsafe version of year.
    • nmonth

      public static void nmonth(long struct, byte value)
      Unsafe version of month.
    • nday

      public static void nday(long struct, byte value)
      Unsafe version of day.
    • nhour

      public static void nhour(long struct, byte value)
      Unsafe version of hour.
    • nminute

      public static void nminute(long struct, byte value)
      Unsafe version of minute.
    • nsecond

      public static void nsecond(long struct, byte value)
      Unsafe version of second.