Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Example of tm use

Tags:

c

tm

Can you give an example of use of tm (I don't know how to initialize that struct) where the current date is written in this format y/m/d?

like image 944
tomss Avatar asked Dec 01 '12 11:12

tomss


People also ask

What is a good example of a trademark?

Brand names like Apple, McDonald's, and Dolce & Gabbana. Product names like iPod and Big Mac. Company logos like the golden arches at McDonald's and NBC's peacock logo.

WHEN CAN TM be used?

TM stands for trademark. The TM symbol (often seen in superscript like this: TM) is usually used in connection with an unregistered mark—a term, slogan, logo, or other indicator—to provide notice to potential infringers that common law rights in the mark are claimed.

How do you use ™?

When Should the Symbols Be Used? Use of trademark symbols is not actually required by law, but doing so is beneficial. In fact, the ™ and SM symbols do not have any legal significance, but instead are informal ways of telling the world that you are claiming ownership of trademark rights in a word, phrase, and/or logo.

What is a trademark use?

A trademark is used for goods, while a service mark is used for services. A trademark: Identifies the source of your goods or services. Provides legal protection for your brand. Helps you guard against counterfeiting and fraud.


1 Answers

How to use tm structure

  1. call time() to get current date/time as number of seconds since 1 Jan 1970.
  2. call localtime() to get struct tm pointer. If you want GMT them call gmtime() instead of localtime().

  3. Use sprintf() or strftime() to convert the struct tm to a string in any format you want.

Example

#include <stdio.h>
#include <time.h>

int main ()
{
  time_t rawtime;
  struct tm * timeinfo;
  char buffer [80];

  time ( &rawtime );
  timeinfo = localtime ( &rawtime );

  strftime (buffer,80,"Now it's %y/%m/%d.",timeinfo);
  puts (buffer);

  return 0;
}

Example Output

Now it's 12/10/24

References:

  • struct tm
  • strftime
like image 123
Jomoos Avatar answered Oct 13 '22 21:10

Jomoos