user2815: I am getting a "does not name a type" error when trying to use makeTime() from the Time.h library, code snippet as follows:
#include<Time.h>

tmElements_t tmet;
tmet.Year = 2013-1970;
tmet.Month = 8;
tmet.Day = 28;
tmet.Hour = 18;
tmet.Minute = 30;
tmet.Second = 0;

time_t dateMet = makeTime(tmet);

Alternatively I've also tried time_t dateMet = maketime(&tmet); with the same result. I am no expert so go easy on me but am I missing something small here?
Thanks

user19016: You're trying to access the 'properties' (i.e. the members) of the tmet variable in a scope where they aren't accessible (outside of a code block). In this global scope of the program the compiler expects a type name on the left side of a statement (i.e. a variable or type declaration), but tmet's members like tmet.Year aren't types in and of themselves.
There are two solutions. You can move the access to the members of tmet into a code block like the setup function:
#include <Time.h>

tmElements_t tmet;
time_t dateMet;

void setup() {
  // put your setup code here, to run once:
    tmet.Year = 2013-1970;
    tmet.Month = 8;
    tmet.Day = 28;
    tmet.Hour = 18;
    tmet.Minute = 30;
    tmet.Second = 0;

    dateMet = makeTime(tmet);
}

void loop() {
  // put your main code here, to run repeatedly:

}

Or you could declare and define tmet in one statement, which has a different syntax (since you have to provide the content of a tmElements_t in a single line:
#include <Time.h>

tmElements_t tmet2 = { 2013-1970, 8, 28, 18, 30, 0 };

time_t dateMet2 = makeTime(tmet2);

void setup() {
  // put your setup code here, to run once:
}

void loop() {
  // put your main code here, to run repeatedly:

}

Both versions work right away from within the Arduino IDE (i.e. I tested them).

2815: <p>I am getting a "does not name a type" error when trying to use <code>makeTime()</code> from the Time.h library, code snippet as follows:</p>

<pre><code>#include&lt;Time.h&gt;

tmElements_t tmet;
tmet.Year = 2013-1970;
tmet.Month = 8;
tmet.Day = 28;
tmet.Hour = 18;
tmet.Minute = 30;
tmet.Second = 0;

time_t dateMet = makeTime(tmet);
</code></pre>

<p>Alternatively I've also tried <code>time_t dateMet = maketime(&amp;tmet);</code> with the same result. I am no expert so go easy on me but am I missing something small here?</p>

<p>Thanks</p>
 19016: <p>You're trying to access the '<em>properties</em>' (i.e. the <em>members</em>) of the <code>tmet</code> variable in a scope where they aren't accessible (outside of a code block). In this global scope of the program the compiler expects a type name on the left side of a statement (i.e. a variable or type declaration), but <code>tmet</code>'s members like <code>tmet.Year</code> aren't types in and of themselves.</p>

<p>There are two solutions. You can move the access to the members of <code>tmet</code> into a code block like the <code>setup</code> function:</p>

<pre><code>#include &lt;Time.h&gt;

tmElements_t tmet;
time_t dateMet;

void setup() {
  // put your setup code here, to run once:
    tmet.Year = 2013-1970;
    tmet.Month = 8;
    tmet.Day = 28;
    tmet.Hour = 18;
    tmet.Minute = 30;
    tmet.Second = 0;

    dateMet = makeTime(tmet);
}

void loop() {
  // put your main code here, to run repeatedly:

}
</code></pre>

<p>Or you could declare and define <code>tmet</code> in one statement, which has a different syntax (since you have to provide the content of a <code>tmElements_t</code> in a single line:</p>

<pre><code>#include &lt;Time.h&gt;

tmElements_t tmet2 = { 2013-1970, 8, 28, 18, 30, 0 };

time_t dateMet2 = makeTime(tmet2);

void setup() {
  // put your setup code here, to run once:
}

void loop() {
  // put your main code here, to run repeatedly:

}
</code></pre>

<p>Both versions work right away from within the Arduino IDE (i.e. I tested them).</p>
