Prusa MINI Firmware overview
pduration_t Struct Reference
Inheritance diagram for pduration_t:
Collaboration diagram for pduration_t:

Public Member Functions

 pduration_t ()
 
 pduration_t (uint32_t const &seconds)
 
void to_string (char *buffer) const
 
- Public Member Functions inherited from duration_t
 duration_t ()
 Constructor. More...
 
 duration_t (uint32_t const &seconds)
 Constructor. More...
 
bool operator== (const uint32_t &value) const
 Equality comparison. More...
 
bool operator!= (const uint32_t &value) const
 Inequality comparison. More...
 
uint8_t year () const
 Formats the duration as years. More...
 
uint16_t day () const
 Formats the duration as days. More...
 
uint32_t hour () const
 Formats the duration as hours. More...
 
uint32_t minute () const
 Formats the duration as minutes. More...
 
uint32_t second () const
 Formats the duration as seconds. More...
 
char * toString (char *const buffer) const
 Formats the duration as a string. More...
 
uint8_t toDigital (char *buffer, bool with_days=false) const
 Formats the duration as a string. More...
 

Additional Inherited Members

- Public Attributes inherited from duration_t
uint32_t value
 Duration is stored in seconds. More...
 

Constructor & Destructor Documentation

◆ pduration_t() [1/2]

pduration_t::pduration_t ( )
171  : pduration_t(0) {};

◆ pduration_t() [2/2]

pduration_t::pduration_t ( uint32_t const seconds)
174  : duration_t(seconds) {}

Member Function Documentation

◆ to_string()

void pduration_t::to_string ( char *  buffer) const
176  {
177  int d = this->day(),
178  h = this->hour() % 24,
179  m = this->minute() % 60,
180  s = this->second() % 60;
181 
182  if (d) {
183  sprintf(buffer, "%3id %2ih %2im", d, h, m);
184  } else if (h) {
185  sprintf(buffer, " %2ih %2im", h, m);
186  } else if (m) {
187  sprintf(buffer, " %2im %2is", m, s);
188  } else {
189  sprintf(buffer, " %2is", s);
190  }
191  }
Here is the call graph for this function:
Here is the caller graph for this function:
duration_t::hour
uint32_t hour() const
Formats the duration as hours.
Definition: duration_t.h:89
duration_t::minute
uint32_t minute() const
Formats the duration as minutes.
Definition: duration_t.h:97
duration_t::day
uint16_t day() const
Formats the duration as days.
Definition: duration_t.h:81
duration_t::duration_t
duration_t()
Constructor.
Definition: duration_t.h:35
pduration_t::pduration_t
pduration_t()
Definition: screen_printing.cpp:170
duration_t::second
uint32_t second() const
Formats the duration as seconds.
Definition: duration_t.h:105