Changeset 4c3ff30 in tol


Ignore:
Timestamp:
Jun 19, 2009, 10:19:59 AM (17 years ago)
Author:
Víctor de Buen <vdebuen@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
dcc8c8b
Parents:
64bb607
Message:

New function BDate DteNowGmt() : Returns todays date and now GMT time

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@1091 be4846ae-f051-483a-831f-b64e7d08527f

Location:
tol/bbasic
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tol/bbasic/dtealgeb.cpp

    r64bb607 r4c3ff30  
    736736    return(BDate(year, month, locTime->tm_mday,
    737737                 locTime->tm_hour, locTime->tm_min, locTime->tm_sec));
     738  }
     739  else
     740  {
     741    return(BDate(0, JANUARY, 0));
     742  }
     743}
     744
     745//--------------------------------------------------------------------
     746BDate DteNowGmt()
     747
     748/*! Returns todays date and now time.
     749 */
     750//--------------------------------------------------------------------
     751{
     752  time_t sec = time(NIL);
     753  struct tm* gmTime = gmtime(&sec);
     754  if (gmTime)
     755  {
     756    BMonth month = (BMonth)(gmTime->tm_mon+1); //localtime()returns0-11months
     757    BInt year = gmTime->tm_year;   // localtime() returns 99 year
     758         year = (year < 1900) ? 1900+year : year;
     759    return(BDate(year, month, gmTime->tm_mday,
     760                 gmTime->tm_hour, gmTime->tm_min, gmTime->tm_sec));
    738761  }
    739762  else
  • tol/bbasic/tol_bdate.h

    r64bb607 r4c3ff30  
    470470//! Returns today date
    471471TOL_API BDate DteToday();
    472 //! Returns todays date and now time
     472//! Returns todays date and now local time
    473473TOL_API BDate DteNow();
     474//! Returns todays date and now GMT time
     475TOL_API BDate DteNowGmt();
    474476//! Returns the date of the Easter's Sunday in the year given as parameter
    475477TOL_API BDate DteEasterSunday(BInt year);
Note: See TracChangeset for help on using the changeset viewer.