Skip to main content
Version: 8.7.x

bfgTimeManager Class

Manage time in UTC or local timezone. More...

Public Member Functions

final Date adjustedDate (long date)
 Adjust a date to match the local CDN server date/time timezone delta. More...
 
int getDaysSinceFirstLaunch (long sessionStart)
 Get days since install (first launch). More...
 
synchronized long getFirstLaunchDateTime ()
 Get the date/time of first launch, in ms since Unix epoch. More...
 

Static Public Member Functions

static long adjustedNowMs ()
 Get current adjusted date/time, in milliseconds. More...
 
static void initialize ()
 Static initializer (must be called before using sharedInstance())
 
static bfgTimeManager sharedInstance ()
 Get shared instance of this singleton.
 

Detailed Description

Manage time in UTC or local timezone.

Member Function Documentation

◆ adjustedDate()

final Date com.bigfishgames.bfglib.bfgTimeManager.adjustedDate (long date)
inline
Adjust a date to match the local CDN server date/time timezone delta.
Parameters
dateDate/time to adjust
Returns
Input date/time adjusted to CDN's timezone

◆ adjustedNowMs()

static long com.bigfishgames.bfglib.bfgTimeManager.adjustedNowMs ()
inlinestatic
Get current adjusted date/time, in milliseconds.
Returns
Current date and time, in milliseconds since Unix epoch, adjusted to server time

◆ getDaysSinceFirstLaunch()

int com.bigfishgames.bfglib.bfgTimeManager.getDaysSinceFirstLaunch (long sessionStart)
inline
Get days since install (first launch). NOTE: This is in elapsed 24-hour days, not calendar days.
Parameters
sessionStartCurrent (or desired) session start date/time to compare against first launch
Since
6.3

◆ getFirstLaunchDateTime()

synchronized long com.bigfishgames.bfglib.bfgTimeManager.getFirstLaunchDateTime ()
inline
Get the date/time of first launch, in ms since Unix epoch. NOTE: This method uses the history settings previously used by bfgHistoryReporting, which is now obsolete, so that we use any first launch data previously stored by bfgHistoryReporting for existing app upgrades.
Returns
Date/time of first launch, in ms. If never calculated before, the current date/time is used as first launch and stored for future lookups
Since
6.3