File: synctime.c

package info (click to toggle)
jpilot 0.97-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 1,244 kB
  • ctags: 957
  • sloc: ansic: 13,558; makefile: 192; sh: 153
file content (68 lines) | stat: -rw-r--r-- 1,738 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/* synctime.c
 *
 * Copyright (C) 1999 by Judd Montgomery
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>

#include <pi-dlp.h>
#include "libplugin.h"


int plugin_get_name(char *name, int len)
{
   strncpy(name, "SyncTime 0.96", len);
   return 0;
}

int plugin_get_help_name(char *name, int len)
{
   strncpy(name, "About SyncTime", len);
   return 0;
}

int plugin_help(char **text, int *width, int *height)
{
   /* We could also pass back *text=NULL */
   *text = strdup(
	   /*-------------------------------------------*/
	   "SyncTime plugin for J-Pilot was written by\r\n"
	   "Judd Montgomery (c) 1999.\r\n"
	   "judd@engineer.com\r\n"
	   "http://jpilot.linuxbox.com\r\n"
	   "SyncTime WILL NOT work with PalmOS 3.3!\r\n"
	   );
   *height = 200;
   *width = 300;
}

int plugin_sync(int sd)
{
   int r;
   time_t ltime;

   jp_init();
   
   jp_logf(LOG_WARN, "synctime: setting the time on pilot\n");
   
   time(&ltime);
   r = dlp_SetSysDateTime(sd, ltime);
   
   return 0;
}