foobar2000 SDK  2015-08-03
Public Member Functions | Protected Attributes
pfc::format_time

#include <string_base.h>

Public Member Functions

 format_time (t_uint64 p_seconds)
 
const char * get_ptr () const
 
 operator const char * () const
 

Protected Attributes

string_fixed_t< 127 > m_buffer
 

Detailed Description

Definition at line 479 of file string_base.h.

Constructor & Destructor Documentation

pfc::format_time::format_time ( t_uint64  p_seconds)

Definition at line 36 of file string_base.cpp.

36  {
37  t_uint64 length = p_seconds;
38  unsigned weeks,days,hours,minutes,seconds;
39 
40  weeks = (unsigned)( ( length / (60*60*24*7) ) );
41  days = (unsigned)( ( length / (60*60*24) ) % 7 );
42  hours = (unsigned) ( ( length / (60 * 60) ) % 24);
43  minutes = (unsigned) ( ( length / (60 ) ) % 60 );
44  seconds = (unsigned) ( ( length ) % 60 );
45 
46  if (weeks) {
47  m_buffer << weeks << "wk ";
48  }
49  if (days || weeks) {
50  m_buffer << days << "d ";
51  }
52  if (hours || days || weeks) {
53  m_buffer << hours << ":" << format_uint(minutes,2) << ":" << format_uint(seconds,2);
54  } else {
55  m_buffer << minutes << ":" << format_uint(seconds,2);
56  }
57 }
uint64_t t_uint64
Definition: int_types.h:3
string_fixed_t< 127 > m_buffer
Definition: string_base.h:485

Member Function Documentation

const char* pfc::format_time::get_ptr ( ) const
inline

Definition at line 482 of file string_base.h.

482 {return m_buffer;}
string_fixed_t< 127 > m_buffer
Definition: string_base.h:485
pfc::format_time::operator const char * ( ) const
inline

Definition at line 483 of file string_base.h.

483 {return m_buffer;}
string_fixed_t< 127 > m_buffer
Definition: string_base.h:485

Field Documentation

string_fixed_t<127> pfc::format_time::m_buffer
protected

Definition at line 485 of file string_base.h.


The documentation for this class was generated from the following files: