Missing Toybox.Time.Duration

Former Member
Former Member
When I try to compile an app with the following statement

using Toybox.Time.Duration as Dur;

I get the error:

BUILD: ERROR: D:\David\DatePlayBox\source\DatePlayBoxView.mc:5: Unknown module Toybox_Time_Duration in using clause

Which is wrong? Me, the compiler or the API documetation at file:///D:/connectiq-sdk-win-1.2.4/doc/frames.html?
  • The using clause applies module names, not class names. i.e.,

    using Toybox.Time; // brings the Toybox.Time module into scope under the name Time

    var x = new Time.Duration(1);

    using Toybox.Lang as L; // similar, but name is L

    var y = new L.String();


    This is covered in the Programmer's Guide
  • Former Member
    Former Member over 9 years ago
    My mistake

    Obviuosly it was me that was wrong :) Thanks for the clarification.
    In my defense, the class pages in the API docs could help by having a 'Defined in module xxx'.