Use Local Time

Always local time first

Tracking Times at Start or Stop:

Q5tz1

Timestamp is displayed in local time (17:23), TimeZone is +02:00 and it’s DST (sommertime) – visualized by the little sun.

… an easy-to-understand Page.

More Info on TimeZone

ca_world

Tapping on the World Icon more details become visible:

Q5tz2

Now details from current TimeZone are visible: Timezone is ‘Europe/Amsterdam‘, Offset is 2 hours from GMT: +02:00 and we can check that GMT is 15:23, where local time is 17:23

Tapping again on the World Icon hides the TimeZone – it’s a toggle.

Here’s the code from QML how this was done:

Container {
  id: tzToggleContainer
  property bool showTimeZone: false
  onShowTimeZoneChanged: {
      startTimeZoneData.visible = showTimeZone
  }
  layout: DockLayout {
  }
  ImageView {
      imageSource: "asset:///images/ca_world.png"
      scalingMethod: ScalingMethod.AspectFit
      horizontalAlignment: HorizontalAlignment.Right
      verticalAlignment: VerticalAlignment.Top
      gestureHandlers: [
          TapHandler {
              onTapped: {
                  tzToggleContainer.showTimeZone = ! tzToggleContainer.showTimeZone
              }
          }
      ]
  }
}

To get the ‘TAP’ on the Image a TapHandler was attached to the ImageView. In onTapped() the value of a custom property (bool showTimeZone) was toggled between true and false. This property is bound to the visible property of another Container: startTimeZoneData

QML makes it easy to connect Objects. This can be done by default properties (visible) or by adding custom properties (showTimeZone).

onShowTimeZoneChanged {} is automatically ‘generated’ by QML and I’m using this to set the visibility of another Container.

Hint: I’m not always using the ‘shortest’ way  to make the code easier to understand. In this case I could have done:

Container {
  id: startTimeZoneData
  visible: tzToggleContainer.showTimeZone
}

Now the knowledge what happenstapping on the ImageView isn’t immediately visible.

Change TimeZone

There can be situations where user has to change the TimeZone: perhaps he/she forgots to start tracking at beginning of travel or smartphone is not set to automatically use the TimeZone from current location.

To change the TimeZone simply tap on the Name (Europe/Amsterdam) and a list of Countries will be pushed on top.

First entry is the Current TimeZone detected from the Phone:

Q5tz3

Tap on a Country and the Timezone will be changed. All re-calculations of Date and Time are done under-the-hood. More details on TimeZone Support see Menu below.

Change Day and Time

If user has the permission to change the Time he/she simply taps on the Start Time and a new Page will be pushed on top allowing to change the Day and / or Time:

Q5tz4

You see: all is simple and easy for default workflow, complexity is hidden, but if there must be something changed it’s also easy to do.

More infos::

TimeZones

Supporting TimeZones is essential for mobile Business App TimeTracker.

ca_world

TimeTracker ‘knows’ some different kinds of  TimeZones:

  • current TimeZone detected from current Location
  • @Home TimeZone aka Company TimeZone
  • UTC / GMT TimeZone with Offset +00:00

By default the local TimeZone is visible for the User.

@Home / Company TimeZone is stored under User Settings.

UTC is always used by internal calculations.

As long as the TimeZone is the current TimeZone it’s easy to get by C++, because the TimeZone is available from CalendarService:

// .hpp
bb::pim::calendar::CalendarService mCalendarService;

// .cpp
QString ConnectedCalendar::currentCalendarTimeZone()
{
    return mCalendarService.settings().currentSystemTimezone();
}

There’s a list of all available TimeZones available deep inside BlackBerry 10. From Device Settings – Date and Time Users can select a TimeZone:

device-list-tz

Unfortunately this list isn’t available from Cascades – there’s no API 😦

So I had to rebuild this from informations in the web on the TimeZones used by BlackBerry.

If selecting a TimeZone manually at first you have to select a Country:

Z30tz1

Z30tz2

I have not implemented logic to find out if the selected TimeZone is using DST (Summertime) for a given Day, so the User will be asked:

Z30tz3

This is only needed in very rare cases, so I think we can live with the workaround – hopefully Cascades will support this soon.

Here TimeZone ‘America/Los_Angeles’ DST was selected:

Z30tz4

Please take a look at the calculated time: 18:36 from 13:37 to 23:13 – TimeTracker caclulated correct because there’s a TimeZone difference of 9 hours between +02:00 and -07:00.

Calendar && two TimeZones

TimeTracker entries can automatically be added to a connected Calendar.

TimeTracker supports multi TimeZones per item as you can see above where we started in Germany and stopped in LA.

Calendar only supports one TimeZone per event, so we have to recalculate start and stop times both using the TimeZone from start. Here’s the corresponding Calendar Event from tracked time with two TimeZones:

Z30cal_tz

Instead of Event ending on July-14 23:13 the Calendar entry ends on July-15 08:13. To inform the user about the real stop time, I added a comment under ‘Notes’.

Here are the times details from Calendar Event:

Z30cal_tz_detail

As usual: all complexitiy hidden to the User !

More infos::

Countries

Crossing Borders

border_cross_gray

For some companies it’s important to know that Service Employees crossed a border between Countries. (Some travel costs will change)

The question comes up HowTo detect this from TimeTracker. We already get the Coordinates from GPS, but from Coordinates there’s no knowledge about the Country this Coordinate belongs to.

The good thing: besides Geo Location Services there’s also a Reverse Geocoding Service getting the address from tracked Coordinates. This address not only contains Street and City, but also the Country. Now it’s easy: as soon as the Country changes, a border was crossed.

It’s up to you HowTo configure the behaviour. If you only want to be notified about the fact that a border was crossed, you only have to track Start and Stop. You need some more details ? Configure Travel Time Category to be tracked continously which means every 15 or 30 minutes or so.

Here GPS Tracking and reverse Geocoding was done at Start and Stop:

Z30_bordercross

TimeTracker detects two different Countries (Germany, United States) and inserted a Marker Icon between Start and Stop to show that a Border was crossed.

More infos: