Beispiel #1
0
static HB_ULONG PackDateTime( void )
{
   union
   {
      struct
      {
         HB_U32 second : 6;         /* bits:  0 -  5 */
         HB_U32 minute : 6;         /* bits:  6 - 11 */
         HB_U32 hour   : 5;         /* bits: 12 - 16 */
         HB_U32 day    : 5;         /* bits: 16 - 21 */
         HB_U32 month  : 4;         /* bits: 22 - 25 */
         HB_U32 year   : 6;         /* bits: 26 - 31 */
      } ts;
      HB_U32 val;
   } u;
   int iYear, iMonth, iDay, iHour, iMinute, iSecond, iMillisec;

   hb_timeStampGetLocal( &iYear, &iMonth, &iDay,
                         &iHour, &iMinute, &iSecond, &iMillisec );

   u.ts.year   = iYear - 1980;
   u.ts.month  = iMonth;
   u.ts.day    = iDay;
   u.ts.hour   = iHour;
   u.ts.minute = iMinute;
   u.ts.second = iSecond;

   return u.val;
}
Beispiel #2
0
void hb_dateToday( int * piYear, int * piMonth, int * piDay )
{
   int iHour, iMinute, iSeconds, iMillisec;

   HB_TRACE( HB_TR_DEBUG, ( "hb_dateToday(%p,%p,%p)", piYear, piMonth, piDay ) );

   hb_timeStampGetLocal( piYear, piMonth, piDay,
                         &iHour, &iMinute, &iSeconds, &iMillisec );
}
Beispiel #3
0
void hb_dateTimeStr( char * pszTime )
{
   int iYear, iMonth, iDay, iHour, iMinute, iSeconds, iMillisec;

   HB_TRACE( HB_TR_DEBUG, ( "hb_dateTimeStr(%p)", pszTime ) );

   hb_timeStampGetLocal( &iYear, &iMonth, &iDay,
                         &iHour, &iMinute, &iSeconds, &iMillisec );
   hb_snprintf( pszTime, 9, "%02d:%02d:%02d", iHour, iMinute, iSeconds );
}
Beispiel #4
0
double hb_dateSeconds( void )
{
   int iYear, iMonth, iDay, iHour, iMinute, iSeconds, iMillisec;

   HB_TRACE( HB_TR_DEBUG, ( "hb_dateSeconds()" ) );

   hb_timeStampGetLocal( &iYear, &iMonth, &iDay,
                         &iHour, &iMinute, &iSeconds, &iMillisec );
   return ( double ) hb_timeEncode( iHour, iMinute, iSeconds, iMillisec ) / 1000;
}
Beispiel #5
0
/* return local timestamp */
void hb_timeStampGet( long * plJulian, long * plMilliSec )
{
   int iYear, iMonth, iDay, iHour, iMinute, iSeconds, iMillisec;

   HB_TRACE( HB_TR_DEBUG, ( "hb_timeStampGet(%p,%p)", plJulian, plMilliSec ) );

   hb_timeStampGetLocal( &iYear, &iMonth, &iDay,
                         &iHour, &iMinute, &iSeconds, &iMillisec );
   *plJulian   = hb_dateEncode( iYear, iMonth, iDay );
   *plMilliSec = hb_timeEncode( iHour, iMinute, iSeconds, iMillisec );
}